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
a5ae018a
Unverified
Commit
a5ae018a
authored
Jan 09, 2020
by
Joe Haddad
Committed by
GitHub
Jan 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test Custom Properties in CSS Modules (#10007)
parent
d0957e30
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
0 deletions
+58
-0
index.js
...ration/css-features/fixtures/cp-el-modules/pages/index.js
+5
-0
styles.module.css
...s-features/fixtures/cp-el-modules/pages/styles.module.css
+7
-0
index.js
...on/css-features/fixtures/cp-global-modules/pages/index.js
+5
-0
styles.module.css
...atures/fixtures/cp-global-modules/pages/styles.module.css
+7
-0
index.test.js
test/integration/css-features/test/index.test.js
+34
-0
No files found.
test/integration/css-features/fixtures/cp-el-modules/pages/index.js
0 → 100644
View file @
a5ae018a
import
styles
from
'./styles.module.css'
export
default
function
()
{
return
<
div
>
{
JSON
.
stringify
(
styles
)}
<
/div
>
}
test/integration/css-features/fixtures/cp-el-modules/pages/styles.module.css
0 → 100644
View file @
a5ae018a
h1
{
--color
:
red
;
}
h1
{
color
:
var
(
--color
);
}
test/integration/css-features/fixtures/cp-global-modules/pages/index.js
0 → 100644
View file @
a5ae018a
import
styles
from
'./styles.module.css'
export
default
function
()
{
return
<
div
>
{
JSON
.
stringify
(
styles
)}
<
/div
>
}
test/integration/css-features/fixtures/cp-global-modules/pages/styles.module.css
0 → 100644
View file @
a5ae018a
:root
{
--color
:
red
;
}
h1
{
color
:
var
(
--color
);
}
test/integration/css-features/test/index.test.js
View file @
a5ae018a
...
@@ -100,6 +100,40 @@ describe('Custom Properties: Pass-Through Modern', () => {
...
@@ -100,6 +100,40 @@ describe('Custom Properties: Pass-Through Modern', () => {
})
})
})
})
describe
(
'Custom Properties: Fail for :root {} in CSS Modules'
,
()
=>
{
const
appDir
=
join
(
fixturesDir
,
'cp-global-modules'
)
beforeAll
(
async
()
=>
{
await
remove
(
join
(
appDir
,
'.next'
))
})
it
(
'should fail to build'
,
async
()
=>
{
const
{
stderr
}
=
await
nextBuild
(
appDir
,
[],
{
stderr
:
true
,
})
expect
(
stderr
).
toContain
(
'Failed to compile'
)
expect
(
stderr
).
toContain
(
'pages/styles.module.css'
)
expect
(
stderr
).
toContain
(
'CssSyntax error: Selector ":root" is not pure'
)
})
})
describe
(
'Custom Properties: Fail for global element in CSS Modules'
,
()
=>
{
const
appDir
=
join
(
fixturesDir
,
'cp-el-modules'
)
beforeAll
(
async
()
=>
{
await
remove
(
join
(
appDir
,
'.next'
))
})
it
(
'should fail to build'
,
async
()
=>
{
const
{
stderr
}
=
await
nextBuild
(
appDir
,
[],
{
stderr
:
true
,
})
expect
(
stderr
).
toContain
(
'Failed to compile'
)
expect
(
stderr
).
toContain
(
'pages/styles.module.css'
)
expect
(
stderr
).
toContain
(
'CssSyntax error: Selector "h1" is not pure'
)
})
})
describe
(
'CSS Modules: Import Global CSS'
,
()
=>
{
describe
(
'CSS Modules: Import Global CSS'
,
()
=>
{
const
appDir
=
join
(
fixturesDir
,
'module-import-global'
)
const
appDir
=
join
(
fixturesDir
,
'module-import-global'
)
...
...
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