Unverified Commit a5ae018a authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

Test Custom Properties in CSS Modules (#10007)

parent d0957e30
import styles from './styles.module.css'
export default function() {
return <div>{JSON.stringify(styles)}</div>
}
import styles from './styles.module.css'
export default function() {
return <div>{JSON.stringify(styles)}</div>
}
......@@ -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', () => {
const appDir = join(fixturesDir, 'module-import-global')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment