File tree 5 files changed +83
-0
lines changed
test/e2e/app-dir/css-modules-pure-no-check
5 files changed +83
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* cssmodules-pure-no-check */
2
+
3
+ /* View Transitions API - requires global scope to work properly */
4
+ : global (::view-transition-old (root )) {
5
+ animation-duration : 0.3s ;
6
+ }
7
+
8
+ /* a local class */
9
+ .home {
10
+ background-color : # f0f0f0 ;
11
+ color : # 333 ;
12
+ font-size : 16px ;
13
+ padding : 20px ;
14
+ }
15
+
16
+ /* a global class */
17
+ : global (.global ) {
18
+ font-weight : 700 ;
19
+ }
Original file line number Diff line number Diff line change
1
+ import type { ReactNode } from 'react'
2
+
3
+ export default function RootLayout ( {
4
+ children,
5
+ } : Readonly < {
6
+ children : ReactNode
7
+ } > ) {
8
+ return (
9
+ < html lang = "en" >
10
+ < body > { children } </ body >
11
+ </ html >
12
+ )
13
+ }
Original file line number Diff line number Diff line change
1
+ import styles from './home.module.css'
2
+
3
+ export default function Home ( ) {
4
+ return (
5
+ < div id = "my-div" className = { `${ styles . home } global` } >
6
+ < div > This text should be bold</ div >
7
+ </ div >
8
+ )
9
+ }
Original file line number Diff line number Diff line change
1
+ import { nextTestSetup } from 'e2e-utils'
2
+ import cheerio from 'cheerio'
3
+
4
+ describe ( 'css-modules-pure-no-check' , ( ) => {
5
+ const { next } = nextTestSetup ( {
6
+ files : __dirname ,
7
+ } )
8
+
9
+ it ( 'should apply styles correctly' , async ( ) => {
10
+ const browser = await next . browser ( '/' )
11
+
12
+ const elementWithGlobalStyles = await browser
13
+ . elementByCss ( '#my-div' )
14
+ . getComputedCss ( 'font-weight' )
15
+
16
+ expect ( elementWithGlobalStyles ) . toBe ( '700' )
17
+ } )
18
+
19
+ it ( 'should have emitted a CSS file' , async ( ) => {
20
+ const html = await next . render ( '/' )
21
+ const $html = cheerio . load ( html )
22
+
23
+ const cssLink = $html ( 'link[rel="stylesheet"]' )
24
+ expect ( cssLink . length ) . toBe ( 1 )
25
+ const cssHref = cssLink [ 0 ] . attribs [ 'href' ]
26
+
27
+ const res = await next . fetch ( cssHref )
28
+ const cssCode = await res . text ( )
29
+
30
+ expect ( cssCode ) . toInclude ( `.global{font-weight:700}` )
31
+ expect ( cssCode ) . toInclude (
32
+ `::view-transition-old(root){animation-duration:.3s}`
33
+ )
34
+ } )
35
+ } )
Original file line number Diff line number Diff line change
1
+ import type { NextConfig } from 'next'
2
+
3
+ const nextConfig : NextConfig = {
4
+ /* config options here */
5
+ }
6
+
7
+ export default nextConfig
You can’t perform that action at this time.
0 commit comments