forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcss-modules-pure-no-check.test.ts
37 lines (29 loc) · 1 KB
/
css-modules-pure-no-check.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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}`
)
})
}
})