Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
9dfc9ebc
Unverified
Commit
9dfc9ebc
authored
Oct 21, 2020
by
Tasuku Uno
Committed by
GitHub
Oct 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix css dependency in /_error (#17301)
parent
e8f402ad
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
136 additions
and
2 deletions
+136
-2
_document.tsx
packages/next/pages/_document.tsx
+1
-2
404.module.css
...integration/document-file-dependencies/css/404.module.css
+3
-0
error.module.css
...tegration/document-file-dependencies/css/error.module.css
+3
-0
global.css
test/integration/document-file-dependencies/css/global.css
+3
-0
index.module.css
...tegration/document-file-dependencies/css/index.module.css
+3
-0
404.js
test/integration/document-file-dependencies/pages/404.js
+9
-0
_app.js
test/integration/document-file-dependencies/pages/_app.js
+7
-0
_error.js
test/integration/document-file-dependencies/pages/_error.js
+9
-0
error-trigger.js
...gration/document-file-dependencies/pages/error-trigger.js
+12
-0
index.js
test/integration/document-file-dependencies/pages/index.js
+9
-0
index.test.js
...integration/document-file-dependencies/test/index.test.js
+77
-0
No files found.
packages/next/pages/_document.tsx
View file @
9dfc9ebc
...
...
@@ -55,8 +55,7 @@ function getDocumentFiles(
pathname
:
string
):
DocumentFiles
{
const
sharedFiles
:
readonly
string
[]
=
getPageFiles
(
buildManifest
,
'/_app'
)
const
pageFiles
:
readonly
string
[]
=
pathname
!==
'/_error'
?
getPageFiles
(
buildManifest
,
pathname
)
:
[]
const
pageFiles
:
readonly
string
[]
=
getPageFiles
(
buildManifest
,
pathname
)
return
{
sharedFiles
,
...
...
test/integration/document-file-dependencies/css/404.module.css
0 → 100644
View file @
9dfc9ebc
.notFound
{
color
:
rgb
(
0
,
255
,
0
);
}
test/integration/document-file-dependencies/css/error.module.css
0 → 100644
View file @
9dfc9ebc
.error
{
color
:
rgb
(
255
,
0
,
0
);
}
test/integration/document-file-dependencies/css/global.css
0 → 100644
View file @
9dfc9ebc
.global
{
background-color
:
rgb
(
200
,
200
,
200
);
}
test/integration/document-file-dependencies/css/index.module.css
0 → 100644
View file @
9dfc9ebc
.index
{
color
:
rgb
(
0
,
0
,
255
);
}
test/integration/document-file-dependencies/pages/404.js
0 → 100644
View file @
9dfc9ebc
import
style
from
'../css/404.module.css'
export
default
function
NotFound
()
{
return
(
<
div
id
=
"notFound"
className
=
{
`global
${
style
.
notFound
}
`
}
>
error
<
/div
>
)
}
test/integration/document-file-dependencies/pages/_app.js
0 → 100644
View file @
9dfc9ebc
import
'../css/global.css'
function
App
({
Component
,
pageProps
})
{
return
<
Component
{...
pageProps
}
/
>
}
export
default
App
test/integration/document-file-dependencies/pages/_error.js
0 → 100644
View file @
9dfc9ebc
import
style
from
'../css/error.module.css'
export
default
function
Error
()
{
return
(
<
div
id
=
"error"
className
=
{
`global
${
style
.
error
}
`
}
>
error
<
/div
>
)
}
test/integration/document-file-dependencies/pages/error-trigger.js
0 → 100644
View file @
9dfc9ebc
function
ErrorTrigger
()
{
return
<
div
>
error
-
trigger
<
/div
>
}
ErrorTrigger
.
getInitialProps
=
()
=>
{
throw
new
Error
(
'Intentional Error'
)
// eslint-disable-next-line no-unreachable
return
{}
}
export
default
ErrorTrigger
test/integration/document-file-dependencies/pages/index.js
0 → 100644
View file @
9dfc9ebc
import
style
from
'../css/index.module.css'
export
default
function
Index
()
{
return
(
<
div
id
=
"index"
className
=
{
`global
${
style
.
index
}
`
}
>
index
<
/div
>
)
}
test/integration/document-file-dependencies/test/index.test.js
0 → 100644
View file @
9dfc9ebc
/* eslint-env jest */
import
{
join
}
from
'path'
import
{
findPort
,
killApp
,
nextBuild
,
nextStart
}
from
'next-test-utils'
import
webdriver
from
'next-webdriver'
jest
.
setTimeout
(
1000
*
60
*
2
)
const
appDir
=
join
(
__dirname
,
'..'
)
let
appPort
let
app
describe
(
'File Dependencies'
,
()
=>
{
describe
(
'production mode'
,
()
=>
{
beforeAll
(
async
()
=>
{
appPort
=
await
findPort
()
await
nextBuild
(
appDir
)
app
=
await
nextStart
(
appDir
,
appPort
)
})
afterAll
(()
=>
killApp
(
app
))
it
(
'should apply styles defined in global and module css files in a standard page.'
,
async
()
=>
{
const
browser
=
await
webdriver
(
appPort
,
'/'
)
await
browser
.
waitForElementByCss
(
'#index'
)
const
styles
=
await
browser
.
eval
(()
=>
{
const
computed
=
getComputedStyle
(
document
.
getElementById
(
'index'
))
return
{
color
:
computed
.
color
,
backgroundColor
:
computed
.
backgroundColor
,
}
})
expect
(
styles
).
toEqual
({
color
:
'rgb(0, 0, 255)'
,
backgroundColor
:
'rgb(200, 200, 200)'
,
})
})
it
(
'should apply styles defined in global and module css files in 404 page'
,
async
()
=>
{
const
browser
=
await
webdriver
(
appPort
,
'/__not_found__'
)
await
browser
.
waitForElementByCss
(
'#notFound'
)
const
styles
=
await
browser
.
eval
(()
=>
{
const
computed
=
getComputedStyle
(
document
.
getElementById
(
'notFound'
))
return
{
color
:
computed
.
color
,
backgroundColor
:
computed
.
backgroundColor
,
}
})
expect
(
styles
).
toEqual
({
color
:
'rgb(0, 255, 0)'
,
backgroundColor
:
'rgb(200, 200, 200)'
,
})
})
it
(
'should apply styles defined in global and module css files in error page'
,
async
()
=>
{
const
browser
=
await
webdriver
(
appPort
,
'/error-trigger'
)
await
browser
.
waitForElementByCss
(
'#error'
)
const
styles
=
await
browser
.
eval
(()
=>
{
const
computed
=
getComputedStyle
(
document
.
getElementById
(
'error'
))
return
{
color
:
computed
.
color
,
backgroundColor
:
computed
.
backgroundColor
,
}
})
expect
(
styles
).
toEqual
({
color
:
'rgb(255, 0, 0)'
,
backgroundColor
:
'rgb(200, 200, 200)'
,
})
})
})
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment