test(ct): vue unmount (#17218)

This commit is contained in:
sand4rt 2022-09-27 22:31:26 +02:00 committed by GitHub
parent d27854f1e7
commit 7be3e5cb82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -86,6 +86,13 @@ test('run hooks', async ({ page, mount }) => {
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}, app: true', 'After mount el: HTMLButtonElement'])
})
test('unmount', async ({ page, mount }) => {
const component = await mount(<Button title="Submit" />)
await expect(page.locator('#root')).toContainText('Submit')
await component.unmount();
await expect(page.locator('#root')).not.toContainText('Submit');
})
test('unmount a multi root component', async ({ mount, page }) => {
const component = await mount(<MultiRoot />)
await expect(page.locator('#root')).toContainText('root 1')

View File

@ -85,6 +85,13 @@ test('run hooks', async ({ page, mount }) => {
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}', 'After mount el: HTMLButtonElement'])
})
test('unmount', async ({ page, mount }) => {
const component = await mount(<Button title="Submit" />)
await expect(page.locator('#root')).toContainText('Submit')
await component.unmount();
await expect(page.locator('#root')).not.toContainText('Submit');
})
test('get textContent of the empty template', async ({ mount }) => {
const component = await mount(<EmptyTemplate />);
expect(await component.allTextContents()).toEqual(['']);