Unverified Commit f3969888 authored by Shu Ding's avatar Shu Ding Committed by GitHub

Add more CSS imports test cases (#38343)



## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
parent a16d8dd4
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import style from './style.module.css'
import './style.css'
export default function ClientComponentRoute() { export default function ClientComponentRoute() {
const [count, setCount] = useState(0) const [count, setCount] = useState(0)
useEffect(() => { useEffect(() => {
...@@ -7,7 +10,9 @@ export default function ClientComponentRoute() { ...@@ -7,7 +10,9 @@ export default function ClientComponentRoute() {
}, [count]) }, [count])
return ( return (
<> <>
<p>hello from app/client-component-route. count: {count}</p> <p className={style.red}>
hello from app/client-component-route. <b>count: {count}</b>
</p>
</> </>
) )
} }
...@@ -298,6 +298,17 @@ describe('views dir', () => { ...@@ -298,6 +298,17 @@ describe('views dir', () => {
).toBe('rgb(255, 0, 0)') ).toBe('rgb(255, 0, 0)')
}) })
it('should support css modules inside client pages', async () => {
const browser = await webdriver(next.url, '/client-component-route')
// Should render p in red
expect(
await browser.eval(
`window.getComputedStyle(document.querySelector('p')).color`
)
).toBe('rgb(255, 0, 0)')
})
it('should support global css inside client layouts', async () => { it('should support global css inside client layouts', async () => {
const browser = await webdriver(next.url, '/client-nested') const browser = await webdriver(next.url, '/client-nested')
...@@ -308,5 +319,16 @@ describe('views dir', () => { ...@@ -308,5 +319,16 @@ describe('views dir', () => {
) )
).toBe('rgb(255, 0, 0)') ).toBe('rgb(255, 0, 0)')
}) })
it('should support global css inside client pages', async () => {
const browser = await webdriver(next.url, '/client-component-route')
// Should render `b` in blue
expect(
await browser.eval(
`window.getComputedStyle(document.querySelector('b')).color`
)
).toBe('rgb(0, 0, 255)')
})
}) })
}) })
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