-
-
Notifications
You must be signed in to change notification settings - Fork 249
Expand file tree
/
Copy pathclass-components.spec.ts
More file actions
28 lines (25 loc) · 892 Bytes
/
class-components.spec.ts
File metadata and controls
28 lines (25 loc) · 892 Bytes
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
import { expect, test } from 'vitest'
import { editFile, isServe, page, untilBrowserLogAfter } from '~utils'
test('should render', async () => {
expect(await page.textContent('span')).toMatch('Hello World')
})
if (isServe) {
test('Class component HMR', async () => {
editFile('src/App.tsx', (code) => code.replace('World', 'class components'))
// await untilBrowserLogAfter(
// () => page.textContent('span'),
// '[vite] hot updated: /src/App.tsx',
// )
await expect
.poll(() => page.textContent('span'))
.toMatch('Hello class components')
editFile('src/utils.tsx', (code) => code.replace('Hello', 'Hi'))
// await untilBrowserLogAfter(
// () => page.textContent('span'),
// '[vite] hot updated: /src/App.tsx',
// )
await expect
.poll(() => page.textContent('span'))
.toMatch('Hi class components')
})
}