Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CoCo_Code_Op2
next.js
提交
9dfc9ebc
N
next.js
项目概览
CoCo_Code_Op2
/
next.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
next.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
9dfc9ebc
编写于
10月 21, 2020
作者:
T
Tasuku Uno
提交者:
GitHub
10月 21, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix css dependency in /_error (#17301)
上级
e8f402ad
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
136 addition
and
2 deletion
+136
-2
packages/next/pages/_document.tsx
packages/next/pages/_document.tsx
+1
-2
test/integration/document-file-dependencies/css/404.module.css
...integration/document-file-dependencies/css/404.module.css
+3
-0
test/integration/document-file-dependencies/css/error.module.css
...tegration/document-file-dependencies/css/error.module.css
+3
-0
test/integration/document-file-dependencies/css/global.css
test/integration/document-file-dependencies/css/global.css
+3
-0
test/integration/document-file-dependencies/css/index.module.css
...tegration/document-file-dependencies/css/index.module.css
+3
-0
test/integration/document-file-dependencies/pages/404.js
test/integration/document-file-dependencies/pages/404.js
+9
-0
test/integration/document-file-dependencies/pages/_app.js
test/integration/document-file-dependencies/pages/_app.js
+7
-0
test/integration/document-file-dependencies/pages/_error.js
test/integration/document-file-dependencies/pages/_error.js
+9
-0
test/integration/document-file-dependencies/pages/error-trigger.js
...gration/document-file-dependencies/pages/error-trigger.js
+12
-0
test/integration/document-file-dependencies/pages/index.js
test/integration/document-file-dependencies/pages/index.js
+9
-0
test/integration/document-file-dependencies/test/index.test.js
...integration/document-file-dependencies/test/index.test.js
+77
-0
未找到文件。
packages/next/pages/_document.tsx
浏览文件 @
9dfc9ebc
...
@@ -55,8 +55,7 @@ function getDocumentFiles(
...
@@ -55,8 +55,7 @@ function getDocumentFiles(
pathname
:
string
pathname
:
string
):
DocumentFiles
{
):
DocumentFiles
{
const
sharedFiles
:
readonly
string
[]
=
getPageFiles
(
buildManifest
,
'
/_app
'
)
const
sharedFiles
:
readonly
string
[]
=
getPageFiles
(
buildManifest
,
'
/_app
'
)
const
pageFiles
:
readonly
string
[]
=
const
pageFiles
:
readonly
string
[]
=
getPageFiles
(
buildManifest
,
pathname
)
pathname
!==
'
/_error
'
?
getPageFiles
(
buildManifest
,
pathname
)
:
[]
return
{
return
{
sharedFiles
,
sharedFiles
,
...
...
test/integration/document-file-dependencies/css/404.module.css
0 → 100644
浏览文件 @
9dfc9ebc
.notFound
{
color
:
rgb
(
0
,
255
,
0
);
}
test/integration/document-file-dependencies/css/error.module.css
0 → 100644
浏览文件 @
9dfc9ebc
.error
{
color
:
rgb
(
255
,
0
,
0
);
}
test/integration/document-file-dependencies/css/global.css
0 → 100644
浏览文件 @
9dfc9ebc
.global
{
background-color
:
rgb
(
200
,
200
,
200
);
}
test/integration/document-file-dependencies/css/index.module.css
0 → 100644
浏览文件 @
9dfc9ebc
.index
{
color
:
rgb
(
0
,
0
,
255
);
}
test/integration/document-file-dependencies/pages/404.js
0 → 100644
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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)
'
,
})
})
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录