mirror of
				https://github.com/microsoft/playwright.git
				synced 2025-06-26 21:40:17 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			20 lines
		
	
	
		
			837 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			837 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { test, expect } from '@playwright/experimental-ct-react17';
 | |
| import Button from '@/components/Button';
 | |
| import MultiRoot from '@/components/MultiRoot';
 | |
| 
 | |
| 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 ({ page, mount }) => {
 | |
|   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');
 | |
| });
 | 
