test(ct): vue unmount (#17218)
This commit is contained in:
parent
d27854f1e7
commit
7be3e5cb82
|
|
@ -86,6 +86,13 @@ test('run hooks', async ({ page, mount }) => {
|
||||||
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}, app: true', 'After mount el: HTMLButtonElement'])
|
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 }) => {
|
test('unmount a multi root component', async ({ mount, page }) => {
|
||||||
const component = await mount(<MultiRoot />)
|
const component = await mount(<MultiRoot />)
|
||||||
await expect(page.locator('#root')).toContainText('root 1')
|
await expect(page.locator('#root')).toContainText('root 1')
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,13 @@ test('run hooks', async ({ page, mount }) => {
|
||||||
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}', 'After mount el: HTMLButtonElement'])
|
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 }) => {
|
test('get textContent of the empty template', async ({ mount }) => {
|
||||||
const component = await mount(<EmptyTemplate />);
|
const component = await mount(<EmptyTemplate />);
|
||||||
expect(await component.allTextContents()).toEqual(['']);
|
expect(await component.allTextContents()).toEqual(['']);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue