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

Add test for server CSS imports (#40019)

Now we are covering all 8 scenarios in our tests: server-client × global-CSS Modules × page-layout. Next step is to cover HMR and page navigation cases.

## 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 f6c96e05
import './style.css' import './style.css'
import styles from './style.module.css'
export default function Page() { export default function Page() {
return <h1>Page</h1> return (
<>
<h1>Page</h1>
<div id="cssm" className={styles.mod}>
CSSM
</div>
</>
)
} }
...@@ -1080,9 +1080,24 @@ describe('app dir', () => { ...@@ -1080,9 +1080,24 @@ describe('app dir', () => {
}) })
}) })
describe.skip('server pages', () => { describe('server pages', () => {
it('should support global css inside server pages', async () => {}) it('should support global css inside server pages', async () => {
it('should support css modules inside server pages', async () => {}) const browser = await webdriver(next.url, '/css/css-page')
expect(
await browser.eval(
`window.getComputedStyle(document.querySelector('h1')).color`
)
).toBe('rgb(255, 0, 0)')
})
it('should support css modules inside server pages', async () => {
const browser = await webdriver(next.url, '/css/css-page')
expect(
await browser.eval(
`window.getComputedStyle(document.querySelector('#cssm')).color`
)
).toBe('rgb(0, 0, 255)')
})
}) })
describe('client layouts', () => { describe('client layouts', () => {
......
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