/
tailwind.spec.ts
40 lines (30 loc) · 1.11 KB
/
tailwind.spec.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
import { isBuild, editFile, untilUpdated, getColor } from '../../testUtils'
test('should render', async () => {
expect(await page.textContent('#pagetitle')).toBe('|Page title|')
})
if (!isBuild) {
test('regenerate CSS and HMR', async () => {
browserLogs.length = 0
const el = await page.$('#pagetitle')
const el2 = await page.$('#helloroot')
expect(await getColor(el)).toBe('rgb(11, 22, 33)')
editFile('src/views/Page.vue', (code) =>
code.replace('|Page title|', '|Page title updated|')
)
await untilUpdated(() => el.textContent(), '|Page title updated|')
expect(browserLogs).toMatchObject([
'[vite] css hot updated: /index.css',
'[vite] hot updated: /src/views/Page.vue'
])
browserLogs.length = 0
editFile('src/components/HelloWorld.vue', (code) =>
code.replace('text-gray-800', 'text-[rgb(10,20,30)]')
)
await untilUpdated(() => getColor(el2), 'rgb(10, 20, 30)')
expect(browserLogs).toMatchObject([
'[vite] css hot updated: /index.css',
'[vite] hot updated: /src/components/HelloWorld.vue'
])
browserLogs.length = 0
})
}