-
Notifications
You must be signed in to change notification settings - Fork 26k
/
css.js
27 lines (25 loc) · 1.1 KB
/
css.js
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
/* eslint-env jest */
import webdriver from 'next-webdriver'
export default function (context) {
it("should include global styles under `runtime: 'edge'`", async () => {
const browser = await webdriver(context.appPort, '/global-styles')
const currentColor = await browser.eval(
`window.getComputedStyle(document.querySelector('#red')).color`
)
expect(currentColor).toMatchInlineSnapshot(`"rgb(255, 0, 0)"`)
})
it('should include global styles with `serverComponents: true`', async () => {
const browser = await webdriver(context.appPort, '/global-styles-rsc')
const currentColor = await browser.eval(
`window.getComputedStyle(document.querySelector('#red')).color`
)
expect(currentColor).toMatchInlineSnapshot(`"rgb(255, 0, 0)"`)
})
it('should include css modules with `serverComponents: true`', async () => {
const browser = await webdriver(context.appPort, '/css-modules')
const currentColor = await browser.eval(
`window.getComputedStyle(document.querySelector('h1')).color`
)
expect(currentColor).toMatchInlineSnapshot(`"rgb(255, 0, 0)"`)
})
}