Commit be4aed48 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig

WIP Pure test

parent 5bbd5ddf
div {
width: 20px;
}
:global(.foo) {
width: 20px;
}
[foo='bar'] {
width: 20px;
}
div,
.foo {
width: 20px;
}
import type { ReactNode } from 'react'
export default function RootLayout({
children,
}: Readonly<{
children: ReactNode
}>) {
return (
<html lang="en">
<body>{children}</body>
</html>
)
}
import styles from './home.module.css'
import pure from './pure.module.css'
export default function Home() {
return (
<div id="my-div" className={`${styles.home} ${pure.root} global`}>
<div>This text should be bold</div>
</div>
)
}
.root {
color: red;
}
:not(:global(.dark-theme)) {
.root {
color: blue;
}
}
import { nextTestSetup } from 'e2e-utils'
import cheerio from 'cheerio'
describe('css-modules-pure-no-check', () => {
const { isNextStart, next } = nextTestSetup({
files: __dirname,
})
it('should apply styles correctly', async () => {
const browser = await next.browser('/')
const elementWithGlobalStyles = await browser
.elementByCss('#my-div')
.getComputedCss('font-weight')
expect(elementWithGlobalStyles).toBe('700')
})
if (isNextStart) {
it('should have emitted a CSS file', async () => {
const html = await next.render('/')
const $html = cheerio.load(html)
const cssLink = $html('link[rel="stylesheet"]')
expect(cssLink.length).toBe(1)
const cssHref = cssLink[0].attribs['href']
const res = await next.fetch(cssHref)
const cssCode = await res.text()
expect(cssCode).toInclude(`.global{font-weight:700}`)
expect(cssCode).toInclude(
`::view-transition-old(root){animation-duration:.3s}`
)
})
}
})
import type { NextConfig } from 'next'
const nextConfig: NextConfig = {
/* config options here */
}
export default nextConfig
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