forked from sand4rt/playwright-ct-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunmount.spec.ts
23 lines (21 loc) · 865 Bytes
/
unmount.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
import { test, expect } from '@sand4rt/experimental-ct-web';
import { Button } from '@/components/Button';
import { MultiRoot } from '@/components/MultiRoot';
test('unmount', async ({ page, mount }) => {
const component = await mount(Button, {
props: {
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');
await expect(page.locator('#root')).toContainText('root 2');
await component.unmount();
await expect(page.locator('#root')).not.toContainText('root 1');
await expect(page.locator('#root')).not.toContainText('root 2');
});