mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
0125959066
Closes #78114 Closes #78096 Closes PACK-4337 cc @jantimon . Thank you for creating the tests, that made it much easier! They are indeed not working with Webpack at the moment: ``` data:text/css+module,.client{font-weight:700} Module parse failed: Unexpected token (1:0) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders > .client{font-weight:700} ```
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
|
|
// CSS data urls are only support in Turbopack
|
|
;(process.env.IS_TURBOPACK_TEST ? describe : describe.skip)(
|
|
'css-modules-data-urls',
|
|
() => {
|
|
const { next } = nextTestSetup({
|
|
files: __dirname,
|
|
})
|
|
|
|
it('should apply rsc class name from data url correctly', async () => {
|
|
const browser = await next.browser('/')
|
|
|
|
const clientElementClass =
|
|
(await browser.elementByCss('#client').getAttribute('class')) || ''
|
|
|
|
expect(clientElementClass).not.toBe('')
|
|
})
|
|
|
|
it('should apply rsc styles from data url correctly', async () => {
|
|
const browser = await next.browser('/')
|
|
|
|
const rscElement = await browser
|
|
.elementByCss('#rsc')
|
|
.getComputedCss('font-weight')
|
|
|
|
expect(rscElement).toBe('700')
|
|
})
|
|
|
|
it('should apply client class name from data url correctly', async () => {
|
|
const browser = await next.browser('/')
|
|
|
|
const clientElementClass =
|
|
(await browser.elementByCss('#client').getAttribute('class')) || ''
|
|
|
|
expect(clientElementClass).not.toBe('')
|
|
})
|
|
|
|
it('should apply client styles from data url correctly', async () => {
|
|
const browser = await next.browser('/')
|
|
|
|
const clientElement = await browser
|
|
.elementByCss('#client')
|
|
.getComputedCss('font-weight')
|
|
|
|
expect(clientElement).toBe('700')
|
|
})
|
|
}
|
|
)
|