-
Notifications
You must be signed in to change notification settings - Fork 26k
/
index.test.ts
51 lines (42 loc) · 1.43 KB
/
index.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { createNext, FileRef } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import webdriver from 'next-webdriver'
describe('CSS webpack Experiment', () => {
describe('with basic CSS', () => {
let next: NextInstance
beforeAll(async () => {
next = await createNext({
files: new FileRef(__dirname),
nextConfig: {
experimental: {
webpackCssExperiment: true,
},
},
dependencies: {
react: 'latest',
'react-dom': 'latest',
sass: 'latest',
},
})
})
afterAll(() => next.destroy())
it('should work with basic CSS', async () => {
const browser = await webdriver(next.url, `/`)
const element = await browser.elementByCss('p')
const color = await element.getComputedCss('color')
expect(color).toBe('rgb(0, 128, 0)')
})
it('should work with CSS modules', async () => {
const browser = await webdriver(next.url, `/css-modules`)
const element = await browser.elementByCss('p')
const color = await element.getComputedCss('color')
expect(color).toBe('rgb(255, 0, 0)')
})
it('should work with SASS', async () => {
const browser = await webdriver(next.url, `/sass`)
const element = await browser.elementByCss('p')
const color = await element.getComputedCss('color')
expect(color).toBe('rgb(0, 0, 255)')
})
})
})