core(ct): rename tests (#17216)
This commit is contained in:
Родитель
81bcbd284f
Коммит
72a18754ef
|
@ -7,7 +7,7 @@ import Counter from './components/Counter';
|
|||
|
||||
test.use({ viewport: { width: 500, height: 500 } });
|
||||
|
||||
test('props should work', async ({ mount }) => {
|
||||
test('render props', async ({ mount }) => {
|
||||
const component = await mount(<Button title="Submit" />);
|
||||
await expect(component).toContainText('Submit');
|
||||
});
|
||||
|
@ -47,7 +47,7 @@ test('renderer updates slots without remounting', async ({ mount }) => {
|
|||
await expect(component.locator('#remount-count')).toContainText('1')
|
||||
})
|
||||
|
||||
test('callback should work', async ({ mount }) => {
|
||||
test('execute callback when the button is clicked', async ({ mount }) => {
|
||||
const messages: string[] = []
|
||||
const component = await mount(<Button title="Submit" onClick={data => {
|
||||
messages.push(data)
|
||||
|
@ -56,14 +56,14 @@ test('callback should work', async ({ mount }) => {
|
|||
expect(messages).toEqual(['hello'])
|
||||
})
|
||||
|
||||
test('default slot should work', async ({ mount }) => {
|
||||
test('render a default child', async ({ mount }) => {
|
||||
const component = await mount(<DefaultChildren>
|
||||
Main Content
|
||||
</DefaultChildren>)
|
||||
await expect(component).toContainText('Main Content')
|
||||
})
|
||||
|
||||
test('multiple children should work', async ({ mount }) => {
|
||||
test('render multiple children', async ({ mount }) => {
|
||||
const component = await mount(<DefaultChildren>
|
||||
<div id="one">One</div>
|
||||
<div id="two">Two</div>
|
||||
|
@ -72,7 +72,7 @@ test('multiple children should work', async ({ mount }) => {
|
|||
await expect(component.locator('#two')).toContainText('Two')
|
||||
})
|
||||
|
||||
test('named children should work', async ({ mount }) => {
|
||||
test('render named children', async ({ mount }) => {
|
||||
const component = await mount(<MultipleChildren>
|
||||
<div>Header</div>
|
||||
<div>Main Content</div>
|
||||
|
@ -83,7 +83,7 @@ test('named children should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('Footer')
|
||||
})
|
||||
|
||||
test('children should callback', async ({ mount }) => {
|
||||
test('execute callback when a child node is clicked', async ({ mount }) => {
|
||||
let clickFired = false;
|
||||
const component = await mount(<DefaultChildren>
|
||||
<span onClick={() => clickFired = true}>Main Content</span>
|
||||
|
@ -92,7 +92,7 @@ test('children should callback', async ({ mount }) => {
|
|||
expect(clickFired).toBeTruthy();
|
||||
})
|
||||
|
||||
test('should run hooks', async ({ page, mount }) => {
|
||||
test('run hooks', async ({ page, mount }) => {
|
||||
const messages: string[] = [];
|
||||
page.on('console', m => messages.push(m.text()));
|
||||
await mount(<Button title="Submit" />, {
|
||||
|
@ -103,14 +103,14 @@ test('should run hooks', async ({ page, mount }) => {
|
|||
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}', 'After mount']);
|
||||
});
|
||||
|
||||
test('should unmount', async ({ page, mount }) => {
|
||||
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 should work', async ({ mount, page }) => {
|
||||
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')
|
||||
|
|
|
@ -10,7 +10,7 @@ import Counter from './components/Counter';
|
|||
|
||||
test.use({ viewport: { width: 500, height: 500 } });
|
||||
|
||||
test('props should work', async ({ mount }) => {
|
||||
test('render props', async ({ mount }) => {
|
||||
const component = await mount(<Button title="Submit" />);
|
||||
await expect(component).toContainText('Submit');
|
||||
});
|
||||
|
@ -50,7 +50,7 @@ test('renderer updates slots without remounting', async ({ mount }) => {
|
|||
await expect(component.locator('#remount-count')).toContainText('1')
|
||||
});
|
||||
|
||||
test('callback should work', async ({ mount }) => {
|
||||
test('execute callback when the button is clicked', async ({ mount }) => {
|
||||
const messages: string[] = []
|
||||
const component = await mount(<Button title="Submit" onClick={data => {
|
||||
messages.push(data)
|
||||
|
@ -59,14 +59,14 @@ test('callback should work', async ({ mount }) => {
|
|||
expect(messages).toEqual(['hello'])
|
||||
})
|
||||
|
||||
test('default slot should work', async ({ mount }) => {
|
||||
test('render a default child', async ({ mount }) => {
|
||||
const component = await mount(<DefaultChildren>
|
||||
Main Content
|
||||
</DefaultChildren>)
|
||||
await expect(component).toContainText('Main Content')
|
||||
})
|
||||
|
||||
test('multiple children should work', async ({ mount }) => {
|
||||
test('render multiple children', async ({ mount }) => {
|
||||
const component = await mount(<DefaultChildren>
|
||||
<div id="one">One</div>
|
||||
<div id="two">Two</div>
|
||||
|
@ -75,7 +75,7 @@ test('multiple children should work', async ({ mount }) => {
|
|||
await expect(component.locator('#two')).toContainText('Two')
|
||||
})
|
||||
|
||||
test('named children should work', async ({ mount }) => {
|
||||
test('render named children', async ({ mount }) => {
|
||||
const component = await mount(<MultipleChildren>
|
||||
<div>Header</div>
|
||||
<div>Main Content</div>
|
||||
|
@ -86,7 +86,7 @@ test('named children should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('Footer')
|
||||
})
|
||||
|
||||
test('children should callback', async ({ mount }) => {
|
||||
test('execute callback when a child node is clicked', async ({ mount }) => {
|
||||
let clickFired = false;
|
||||
const component = await mount(<DefaultChildren>
|
||||
<span onClick={() => clickFired = true}>Main Content</span>
|
||||
|
@ -95,7 +95,7 @@ test('children should callback', async ({ mount }) => {
|
|||
expect(clickFired).toBeTruthy();
|
||||
})
|
||||
|
||||
test('should run hooks', async ({ page, mount }) => {
|
||||
test('run hooks', async ({ page, mount }) => {
|
||||
const messages: string[] = [];
|
||||
page.on('console', m => messages.push(m.text()));
|
||||
await mount(<Button title="Submit" />, {
|
||||
|
@ -106,14 +106,14 @@ test('should run hooks', async ({ page, mount }) => {
|
|||
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}', 'After mount']);
|
||||
});
|
||||
|
||||
test('should unmount', async ({ page, mount }) => {
|
||||
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 should work', async ({ mount, page }) => {
|
||||
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')
|
||||
|
@ -122,7 +122,7 @@ test('unmount a multi root component should work', async ({ mount, page }) => {
|
|||
await expect(page.locator('#root')).not.toContainText('root 2')
|
||||
})
|
||||
|
||||
test('toHaveText works on delayed data', async ({ mount }) => {
|
||||
test('render delayed data', async ({ mount }) => {
|
||||
const component = await mount(<DelayedData data='complete' />);
|
||||
await expect(component).toHaveText('complete');
|
||||
});
|
||||
|
|
|
@ -5,12 +5,12 @@ import MultiRoot from './components/MultiRoot';
|
|||
|
||||
test.use({ viewport: { width: 500, height: 500 } });
|
||||
|
||||
test('props should work', async ({ mount }) => {
|
||||
test('render props', async ({ mount }) => {
|
||||
const component = await mount(<Button title="Submit" />);
|
||||
await expect(component).toContainText('Submit');
|
||||
});
|
||||
|
||||
test('callback should work', async ({ mount }) => {
|
||||
test('execute callback when the button is clicked', async ({ mount }) => {
|
||||
const messages: string[] = []
|
||||
const component = await mount(<Button title="Submit" onClick={data => {
|
||||
messages.push(data)
|
||||
|
@ -26,7 +26,7 @@ test('default child should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('Main Content')
|
||||
})
|
||||
|
||||
test('should run hooks', async ({ page, mount }) => {
|
||||
test('run hooks', async ({ page, mount }) => {
|
||||
const messages: string[] = [];
|
||||
page.on('console', m => messages.push(m.text()));
|
||||
await mount(<Button title="Submit" />, {
|
||||
|
@ -37,14 +37,14 @@ test('should run hooks', async ({ page, mount }) => {
|
|||
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}', 'After mount']);
|
||||
});
|
||||
|
||||
test('should unmount', async ({ page, mount }) => {
|
||||
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 should work', async ({ mount, page }) => {
|
||||
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')
|
||||
|
|
|
@ -21,7 +21,7 @@ import MultiRoot from './components/MultiRoot.svelte';
|
|||
|
||||
test.use({ viewport: { width: 500, height: 500 } });
|
||||
|
||||
test('props should work', async ({ mount }) => {
|
||||
test('render props', async ({ mount }) => {
|
||||
const component = await mount(Button, {
|
||||
props: {
|
||||
title: 'Submit'
|
||||
|
@ -30,7 +30,7 @@ test('props should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('Submit')
|
||||
})
|
||||
|
||||
test('event should work', async ({ mount }) => {
|
||||
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
||||
const messages = []
|
||||
const component = await mount(Button, {
|
||||
props: {
|
||||
|
@ -44,7 +44,7 @@ test('event should work', async ({ mount }) => {
|
|||
expect(messages).toEqual(['hello'])
|
||||
})
|
||||
|
||||
test('default slot should work', async ({ mount }) => {
|
||||
test('render a default slot', async ({ mount }) => {
|
||||
const component = await mount(DefaultSlot, {
|
||||
slots: {
|
||||
default: 'Main Content'
|
||||
|
@ -53,7 +53,7 @@ test('default slot should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('Main Content')
|
||||
})
|
||||
|
||||
test('should run hooks', async ({ page, mount }) => {
|
||||
test('run hooks', async ({ page, mount }) => {
|
||||
const messages = []
|
||||
page.on('console', m => messages.push(m.text()))
|
||||
await mount(Button, {
|
||||
|
@ -65,7 +65,7 @@ test('should run hooks', async ({ page, mount }) => {
|
|||
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}', 'After mount']);
|
||||
})
|
||||
|
||||
test('should unmount', async ({ page, mount }) => {
|
||||
test('unmount', async ({ page, mount }) => {
|
||||
const component = await mount(Button, {
|
||||
props: {
|
||||
title: 'Submit'
|
||||
|
@ -76,7 +76,7 @@ test('should unmount', async ({ page, mount }) => {
|
|||
await expect(page.locator('#root')).not.toContainText('Submit');
|
||||
});
|
||||
|
||||
test('unmount a multi root component should work', async ({ mount, page }) => {
|
||||
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')
|
||||
|
|
|
@ -21,7 +21,7 @@ import MultiRoot from './components/MultiRoot.svelte';
|
|||
|
||||
test.use({ viewport: { width: 500, height: 500 } });
|
||||
|
||||
test('props should work', async ({ mount }) => {
|
||||
test('render props', async ({ mount }) => {
|
||||
const component = await mount(Button, {
|
||||
props: {
|
||||
title: 'Submit'
|
||||
|
@ -30,7 +30,7 @@ test('props should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('Submit')
|
||||
})
|
||||
|
||||
test('event should work', async ({ mount }) => {
|
||||
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
||||
const messages = []
|
||||
const component = await mount(Button, {
|
||||
props: {
|
||||
|
@ -44,7 +44,7 @@ test('event should work', async ({ mount }) => {
|
|||
expect(messages).toEqual(['hello'])
|
||||
})
|
||||
|
||||
test('default slot should work', async ({ mount }) => {
|
||||
test('render a default slot', async ({ mount }) => {
|
||||
const component = await mount(DefaultSlot, {
|
||||
slots: {
|
||||
default: 'Main Content'
|
||||
|
@ -53,7 +53,7 @@ test('default slot should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('Main Content')
|
||||
})
|
||||
|
||||
test('should run hooks', async ({ page, mount }) => {
|
||||
test('run hooks', async ({ page, mount }) => {
|
||||
const messages = []
|
||||
page.on('console', m => messages.push(m.text()))
|
||||
await mount(Button, {
|
||||
|
@ -65,7 +65,7 @@ test('should run hooks', async ({ page, mount }) => {
|
|||
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}', 'After mount']);
|
||||
})
|
||||
|
||||
test('should unmount', async ({ page, mount }) => {
|
||||
test('unmount', async ({ page, mount }) => {
|
||||
const component = await mount(Button, {
|
||||
props: {
|
||||
title: 'Submit'
|
||||
|
@ -76,7 +76,7 @@ test('should unmount', async ({ page, mount }) => {
|
|||
await expect(page.locator('#root')).not.toContainText('Submit');
|
||||
});
|
||||
|
||||
test('unmount a multi root component should work', async ({ mount, page }) => {
|
||||
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')
|
||||
|
|
|
@ -7,7 +7,7 @@ import MultiRoot from './components/MultiRoot.vue'
|
|||
|
||||
test.use({ viewport: { width: 500, height: 500 } })
|
||||
|
||||
test('props should work', async ({ mount }) => {
|
||||
test('render props', async ({ mount }) => {
|
||||
const component = await mount(<Button title="Submit" />)
|
||||
await expect(component).toContainText('Submit')
|
||||
})
|
||||
|
@ -25,7 +25,7 @@ test('renderer and keep the component instance intact', async ({ mount }) => {
|
|||
await expect(component.locator('#remount-count')).toContainText('1')
|
||||
})
|
||||
|
||||
test('event should work', async ({ mount }) => {
|
||||
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
||||
const messages = []
|
||||
const component = await mount(<Button title='Submit' v-on:submit={data => {
|
||||
messages.push(data)
|
||||
|
@ -34,14 +34,14 @@ test('event should work', async ({ mount }) => {
|
|||
expect(messages).toEqual(['hello'])
|
||||
})
|
||||
|
||||
test('default slot should work', async ({ mount }) => {
|
||||
test('render a default slot', async ({ mount }) => {
|
||||
const component = await mount(<DefaultSlot>
|
||||
Main Content
|
||||
</DefaultSlot>)
|
||||
await expect(component).toContainText('Main Content')
|
||||
})
|
||||
|
||||
test('multiple slots should work', async ({ mount }) => {
|
||||
test('render a component with multiple children', async ({ mount }) => {
|
||||
const component = await mount(<DefaultSlot>
|
||||
<div id="one">One</div>
|
||||
<div id="two">Two</div>
|
||||
|
@ -50,7 +50,7 @@ test('multiple slots should work', async ({ mount }) => {
|
|||
await expect(component.locator('#two')).toContainText('Two')
|
||||
})
|
||||
|
||||
test('named slots should work', async ({ mount }) => {
|
||||
test('render a component with a named slot', async ({ mount }) => {
|
||||
const component = await mount(<NamedSlots>
|
||||
<template v-slot:header>
|
||||
Header
|
||||
|
@ -67,7 +67,7 @@ test('named slots should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('Footer')
|
||||
})
|
||||
|
||||
test('slot should emit events', async ({ mount }) => {
|
||||
test('emit a event when a slot is clicked', async ({ mount }) => {
|
||||
let clickFired = false;
|
||||
const component = await mount(<DefaultSlot>
|
||||
<span v-on:click={() => clickFired = true}>Main Content</span>
|
||||
|
@ -76,7 +76,7 @@ test('slot should emit events', async ({ mount }) => {
|
|||
expect(clickFired).toBeTruthy();
|
||||
})
|
||||
|
||||
test('should run hooks', async ({ page, mount }) => {
|
||||
test('run hooks', async ({ page, mount }) => {
|
||||
const messages = []
|
||||
page.on('console', m => messages.push(m.text()))
|
||||
await mount(<Button title="Submit" />, {
|
||||
|
@ -85,7 +85,7 @@ test('should run hooks', async ({ page, mount }) => {
|
|||
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}, app: true', 'After mount el: HTMLButtonElement'])
|
||||
})
|
||||
|
||||
test('unmount a multi root component should work', async ({ mount, page }) => {
|
||||
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')
|
||||
|
|
|
@ -9,7 +9,7 @@ import Component from './components/Component.vue'
|
|||
|
||||
test.use({ viewport: { width: 500, height: 500 } })
|
||||
|
||||
test('props should work', async ({ mount }) => {
|
||||
test('render props', async ({ mount }) => {
|
||||
const component = await mount(Button, {
|
||||
props: {
|
||||
title: 'Submit'
|
||||
|
@ -35,7 +35,7 @@ test('renderer and keep the component instance intact', async ({ mount }) => {
|
|||
await expect(component.locator('#remount-count')).toContainText('1')
|
||||
})
|
||||
|
||||
test('event should work', async ({ mount }) => {
|
||||
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
||||
const messages = []
|
||||
const component = await mount(Button, {
|
||||
props: {
|
||||
|
@ -49,7 +49,7 @@ test('event should work', async ({ mount }) => {
|
|||
expect(messages).toEqual(['hello'])
|
||||
})
|
||||
|
||||
test('default slot should work', async ({ mount }) => {
|
||||
test('render a default slot', async ({ mount }) => {
|
||||
const component = await mount(DefaultSlot, {
|
||||
slots: {
|
||||
default: 'Main Content'
|
||||
|
@ -58,7 +58,7 @@ test('default slot should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('Main Content')
|
||||
})
|
||||
|
||||
test('multiple slots should work', async ({ mount }) => {
|
||||
test('render a component with multiple slots', async ({ mount }) => {
|
||||
const component = await mount(DefaultSlot, {
|
||||
slots: {
|
||||
default: ['one', 'two']
|
||||
|
@ -68,7 +68,7 @@ test('multiple slots should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('two')
|
||||
})
|
||||
|
||||
test('named slots should work', async ({ mount }) => {
|
||||
test('render a component with a named slot', async ({ mount }) => {
|
||||
const component = await mount(NamedSlots, {
|
||||
slots: {
|
||||
header: 'Header',
|
||||
|
@ -81,12 +81,12 @@ test('named slots should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('Footer')
|
||||
})
|
||||
|
||||
test('optionless should work', async ({ mount }) => {
|
||||
test('render a component without options', async ({ mount }) => {
|
||||
const component = await mount(Component)
|
||||
await expect(component).toContainText('test')
|
||||
})
|
||||
|
||||
test('should run hooks', async ({ page, mount }) => {
|
||||
test('run hooks', async ({ page, mount }) => {
|
||||
const messages = []
|
||||
page.on('console', m => messages.push(m.text()))
|
||||
await mount(Button, {
|
||||
|
@ -98,7 +98,7 @@ test('should run hooks', async ({ page, mount }) => {
|
|||
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}, app: true', 'After mount el: HTMLButtonElement'])
|
||||
})
|
||||
|
||||
test('should unmount', async ({ page, mount }) => {
|
||||
test('unmount', async ({ page, mount }) => {
|
||||
const component = await mount(Button, {
|
||||
props: {
|
||||
title: 'Submit'
|
||||
|
@ -109,7 +109,7 @@ test('should unmount', async ({ page, mount }) => {
|
|||
await expect(page.locator('#root')).not.toContainText('Submit');
|
||||
});
|
||||
|
||||
test('unmount a multi root component should work', async ({ mount, page }) => {
|
||||
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')
|
||||
|
|
|
@ -7,7 +7,7 @@ import MultiRoot from './components/MultiRoot.vue'
|
|||
|
||||
test.use({ viewport: { width: 500, height: 500 } })
|
||||
|
||||
test('props should work', async ({ mount }) => {
|
||||
test('render props', async ({ mount }) => {
|
||||
const component = await mount(<Button title="Submit" />)
|
||||
await expect(component).toContainText('Submit')
|
||||
})
|
||||
|
@ -25,7 +25,7 @@ test('renderer and keep the component instance intact', async ({ mount }) => {
|
|||
await expect(component.locator('#remount-count')).toContainText('1')
|
||||
})
|
||||
|
||||
test('event should work', async ({ mount }) => {
|
||||
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
||||
const messages = []
|
||||
const component = await mount(<Button title='Submit' v-on:submit={data => {
|
||||
messages.push(data)
|
||||
|
@ -34,14 +34,14 @@ test('event should work', async ({ mount }) => {
|
|||
expect(messages).toEqual(['hello'])
|
||||
})
|
||||
|
||||
test('default slot should work', async ({ mount }) => {
|
||||
test('render a default slot', async ({ mount }) => {
|
||||
const component = await mount(<DefaultSlot>
|
||||
Main Content
|
||||
</DefaultSlot>)
|
||||
await expect(component).toContainText('Main Content')
|
||||
})
|
||||
|
||||
test('multiple slots should work', async ({ mount }) => {
|
||||
test('render a component with multiple slots', async ({ mount }) => {
|
||||
const component = await mount(<DefaultSlot>
|
||||
<div id="one">One</div>
|
||||
<div id="two">Two</div>
|
||||
|
@ -50,7 +50,7 @@ test('multiple slots should work', async ({ mount }) => {
|
|||
await expect(component.locator('#two')).toContainText('Two')
|
||||
})
|
||||
|
||||
test('named slots should work', async ({ mount }) => {
|
||||
test('render a component with a named slot', async ({ mount }) => {
|
||||
const component = await mount(<NamedSlots>
|
||||
<template v-slot:header>
|
||||
Header
|
||||
|
@ -67,7 +67,7 @@ test('named slots should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('Footer')
|
||||
})
|
||||
|
||||
test('slot should emit events', async ({ mount }) => {
|
||||
test('emit a event when a slot is clicked', async ({ mount }) => {
|
||||
let clickFired = false;
|
||||
const component = await mount(<DefaultSlot>
|
||||
<span v-on:click={() => clickFired = true}>Main Content</span>
|
||||
|
@ -76,7 +76,7 @@ test('slot should emit events', async ({ mount }) => {
|
|||
expect(clickFired).toBeTruthy();
|
||||
})
|
||||
|
||||
test('should run hooks', async ({ page, mount }) => {
|
||||
test('run hooks', async ({ page, mount }) => {
|
||||
const messages = []
|
||||
page.on('console', m => messages.push(m.text()))
|
||||
await mount(<Button title="Submit" />, {
|
||||
|
@ -85,7 +85,7 @@ test('should run hooks', async ({ page, mount }) => {
|
|||
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}, app: true', 'After mount el: HTMLButtonElement'])
|
||||
})
|
||||
|
||||
test('unmount a multi root component should work', async ({ mount, page }) => {
|
||||
test('unmount a multi root component', async ({ mount, page }) => {
|
||||
const component = await mount(<MultiRoot />)
|
||||
|
||||
await expect(page.locator('#root')).toContainText('root 1')
|
||||
|
|
|
@ -8,7 +8,7 @@ import Component from './components/Component.vue'
|
|||
|
||||
test.use({ viewport: { width: 500, height: 500 } })
|
||||
|
||||
test('props should work', async ({ mount }) => {
|
||||
test('render props', async ({ mount }) => {
|
||||
const component = await mount(Button, {
|
||||
props: {
|
||||
title: 'Submit'
|
||||
|
@ -35,7 +35,7 @@ test('renderer and keep the component instance intact', async ({ mount }) => {
|
|||
})
|
||||
|
||||
|
||||
test('event should work', async ({ mount }) => {
|
||||
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
||||
const messages = []
|
||||
const component = await mount(Button, {
|
||||
props: {
|
||||
|
@ -49,7 +49,7 @@ test('event should work', async ({ mount }) => {
|
|||
expect(messages).toEqual(['hello'])
|
||||
})
|
||||
|
||||
test('default slot should work', async ({ mount }) => {
|
||||
test('render a default slot', async ({ mount }) => {
|
||||
const component = await mount(DefaultSlot, {
|
||||
slots: {
|
||||
default: 'Main Content'
|
||||
|
@ -58,7 +58,7 @@ test('default slot should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('Main Content')
|
||||
})
|
||||
|
||||
test('multiple slots should work', async ({ mount }) => {
|
||||
test('render a component with multiple slots', async ({ mount }) => {
|
||||
const component = await mount(DefaultSlot, {
|
||||
slots: {
|
||||
default: ['one', 'two']
|
||||
|
@ -68,7 +68,7 @@ test('multiple slots should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('two')
|
||||
})
|
||||
|
||||
test('named slots should work', async ({ mount }) => {
|
||||
test('render a component with a named slot', async ({ mount }) => {
|
||||
const component = await mount(NamedSlots, {
|
||||
slots: {
|
||||
header: 'Header',
|
||||
|
@ -81,12 +81,12 @@ test('named slots should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('Footer')
|
||||
})
|
||||
|
||||
test('optionless should work', async ({ mount }) => {
|
||||
test('render a component without options', async ({ mount }) => {
|
||||
const component = await mount(Component)
|
||||
await expect(component).toContainText('test')
|
||||
})
|
||||
|
||||
test('should run hooks', async ({ page, mount }) => {
|
||||
test('run hooks', async ({ page, mount }) => {
|
||||
const messages = []
|
||||
page.on('console', m => messages.push(m.text()))
|
||||
await mount(Button, {
|
||||
|
@ -98,7 +98,7 @@ test('should run hooks', async ({ page, mount }) => {
|
|||
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}, app: true', 'After mount el: HTMLButtonElement'])
|
||||
})
|
||||
|
||||
test('unmount a multi root component should work', async ({ mount, page }) => {
|
||||
test('unmount a multi root component', async ({ mount, page }) => {
|
||||
const component = await mount(MultiRoot)
|
||||
|
||||
await expect(page.locator('#root')).toContainText('root 1')
|
||||
|
|
|
@ -9,7 +9,7 @@ import Component from './components/Component.vue'
|
|||
|
||||
test.use({ viewport: { width: 500, height: 500 } })
|
||||
|
||||
test('props should work', async ({ mount }) => {
|
||||
test('render props', async ({ mount }) => {
|
||||
const component = await mount(Button, {
|
||||
props: {
|
||||
title: 'Submit'
|
||||
|
@ -35,7 +35,7 @@ test('renderer and keep the component instance intact', async ({ mount }) => {
|
|||
await expect(component.locator('#remount-count')).toContainText('1')
|
||||
})
|
||||
|
||||
test('event should work', async ({ mount }) => {
|
||||
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
||||
const messages = []
|
||||
const component = await mount(Button, {
|
||||
props: {
|
||||
|
@ -49,7 +49,7 @@ test('event should work', async ({ mount }) => {
|
|||
expect(messages).toEqual(['hello'])
|
||||
})
|
||||
|
||||
test('default slot should work', async ({ mount }) => {
|
||||
test('render a default slot', async ({ mount }) => {
|
||||
const component = await mount(DefaultSlot, {
|
||||
slots: {
|
||||
default: 'Main Content'
|
||||
|
@ -58,7 +58,7 @@ test('default slot should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('Main Content')
|
||||
})
|
||||
|
||||
test('multiple slots should work', async ({ mount }) => {
|
||||
test('render a component with multiple slots', async ({ mount }) => {
|
||||
const component = await mount(DefaultSlot, {
|
||||
slots: {
|
||||
default: ['one', 'two']
|
||||
|
@ -68,7 +68,7 @@ test('multiple slots should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('two')
|
||||
})
|
||||
|
||||
test('named slots should work', async ({ mount }) => {
|
||||
test('render a component with a named slot', async ({ mount }) => {
|
||||
const component = await mount(NamedSlots, {
|
||||
slots: {
|
||||
header: 'Header',
|
||||
|
@ -81,12 +81,12 @@ test('named slots should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('Footer')
|
||||
})
|
||||
|
||||
test('optionless should work', async ({ mount }) => {
|
||||
test('render a component without options', async ({ mount }) => {
|
||||
const component = await mount(Component)
|
||||
await expect(component).toContainText('test')
|
||||
})
|
||||
|
||||
test('should run hooks', async ({ page, mount }) => {
|
||||
test('run hooks', async ({ page, mount }) => {
|
||||
const messages = []
|
||||
page.on('console', m => messages.push(m.text()))
|
||||
await mount(Button, {
|
||||
|
@ -98,7 +98,7 @@ test('should run hooks', async ({ page, mount }) => {
|
|||
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}, app: true', 'After mount el: HTMLButtonElement'])
|
||||
})
|
||||
|
||||
test('should unmount', async ({ page, mount }) => {
|
||||
test('unmount', async ({ page, mount }) => {
|
||||
const component = await mount(Button, {
|
||||
props: {
|
||||
title: 'Submit'
|
||||
|
@ -109,7 +109,7 @@ test('should unmount', async ({ page, mount }) => {
|
|||
await expect(page.locator('#root')).not.toContainText('Submit');
|
||||
});
|
||||
|
||||
test('unmount a multi root component should work', async ({ mount, page }) => {
|
||||
test('unmount a multi root component', async ({ mount, page }) => {
|
||||
const component = await mount(MultiRoot)
|
||||
|
||||
await expect(page.locator('#root')).toContainText('root 1')
|
||||
|
|
|
@ -6,7 +6,7 @@ import NamedSlots from './components/NamedSlots.vue'
|
|||
|
||||
test.use({ viewport: { width: 500, height: 500 } })
|
||||
|
||||
test('props should work', async ({ mount }) => {
|
||||
test('render props', async ({ mount }) => {
|
||||
const component = await mount(<Button title="Submit" />)
|
||||
await expect(component).toContainText('Submit')
|
||||
})
|
||||
|
@ -24,7 +24,7 @@ test('renderer and keep the component instance intact', async ({ mount }) => {
|
|||
await expect(component.locator('#remount-count')).toContainText('1')
|
||||
})
|
||||
|
||||
test('event should work', async ({ mount }) => {
|
||||
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
||||
const messages = []
|
||||
const component = await mount(<Button title='Submit' v-on:submit={data => {
|
||||
messages.push(data)
|
||||
|
@ -33,14 +33,14 @@ test('event should work', async ({ mount }) => {
|
|||
expect(messages).toEqual(['hello'])
|
||||
})
|
||||
|
||||
test('default slot should work', async ({ mount }) => {
|
||||
test('render a default slot', async ({ mount }) => {
|
||||
const component = await mount(<DefaultSlot>
|
||||
Main Content
|
||||
</DefaultSlot>)
|
||||
await expect(component).toContainText('Main Content')
|
||||
})
|
||||
|
||||
test('multiple slots should work', async ({ mount }) => {
|
||||
test('render a component with multiple slots', async ({ mount }) => {
|
||||
const component = await mount(<DefaultSlot>
|
||||
<div id="one">One</div>
|
||||
<div id="two">Two</div>
|
||||
|
@ -49,7 +49,7 @@ test('multiple slots should work', async ({ mount }) => {
|
|||
await expect(component.locator('#two')).toContainText('Two')
|
||||
})
|
||||
|
||||
test('named slots should work', async ({ mount }) => {
|
||||
test('render a component with a named slot', async ({ mount }) => {
|
||||
const component = await mount(<NamedSlots>
|
||||
<template v-slot:header>
|
||||
Header
|
||||
|
@ -66,7 +66,7 @@ test('named slots should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('Footer')
|
||||
})
|
||||
|
||||
test('slot should emit events', async ({ mount }) => {
|
||||
test('emit a event when a slot is clicked', async ({ mount }) => {
|
||||
let clickFired = false;
|
||||
const component = await mount(<DefaultSlot>
|
||||
<span v-on:click={() => clickFired = true}>Main Content</span>
|
||||
|
@ -75,7 +75,7 @@ test('slot should emit events', async ({ mount }) => {
|
|||
expect(clickFired).toBeTruthy();
|
||||
})
|
||||
|
||||
test('should run hooks', async ({ page, mount }) => {
|
||||
test('run hooks', async ({ page, mount }) => {
|
||||
const messages = []
|
||||
page.on('console', m => messages.push(m.text()))
|
||||
await mount(<Button title="Submit" />, {
|
||||
|
|
|
@ -7,7 +7,7 @@ import Component from './components/Component.vue'
|
|||
|
||||
test.use({ viewport: { width: 500, height: 500 } })
|
||||
|
||||
test('props should work', async ({ mount }) => {
|
||||
test('render props', async ({ mount }) => {
|
||||
const component = await mount(Button, {
|
||||
props: {
|
||||
title: 'Submit'
|
||||
|
@ -33,7 +33,7 @@ test('renderer and keep the component instance intact', async ({ mount }) => {
|
|||
await expect(component.locator('#remount-count')).toContainText('1')
|
||||
})
|
||||
|
||||
test('event should work', async ({ mount }) => {
|
||||
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
||||
const messages = []
|
||||
const component = await mount(Button, {
|
||||
props: {
|
||||
|
@ -47,7 +47,7 @@ test('event should work', async ({ mount }) => {
|
|||
expect(messages).toEqual(['hello'])
|
||||
})
|
||||
|
||||
test('default slot should work', async ({ mount }) => {
|
||||
test('render a default slot', async ({ mount }) => {
|
||||
const component = await mount(DefaultSlot, {
|
||||
slots: {
|
||||
default: 'Main Content'
|
||||
|
@ -56,7 +56,7 @@ test('default slot should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('Main Content')
|
||||
})
|
||||
|
||||
test('multiple slots should work', async ({ mount }) => {
|
||||
test('render a component with multiple slots', async ({ mount }) => {
|
||||
const component = await mount(DefaultSlot, {
|
||||
slots: {
|
||||
default: ['one', 'two']
|
||||
|
@ -66,7 +66,7 @@ test('multiple slots should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('two')
|
||||
})
|
||||
|
||||
test('named slots should work', async ({ mount }) => {
|
||||
test('render a component with a named slot', async ({ mount }) => {
|
||||
const component = await mount(NamedSlots, {
|
||||
slots: {
|
||||
header: 'Header',
|
||||
|
@ -79,12 +79,12 @@ test('named slots should work', async ({ mount }) => {
|
|||
await expect(component).toContainText('Footer')
|
||||
})
|
||||
|
||||
test('optionless should work', async ({ mount }) => {
|
||||
test('render a component without options', async ({ mount }) => {
|
||||
const component = await mount(Component)
|
||||
await expect(component).toContainText('test')
|
||||
})
|
||||
|
||||
test('should run hooks', async ({ page, mount }) => {
|
||||
test('run hooks', async ({ page, mount }) => {
|
||||
const messages = []
|
||||
page.on('console', m => messages.push(m.text()))
|
||||
await mount(Button, {
|
||||
|
@ -96,7 +96,7 @@ test('should run hooks', async ({ page, mount }) => {
|
|||
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}', 'After mount el: HTMLButtonElement'])
|
||||
})
|
||||
|
||||
test('should unmount', async ({ page, mount }) => {
|
||||
test('unmount', async ({ page, mount }) => {
|
||||
const component = await mount(Button, {
|
||||
props: {
|
||||
title: 'Submit'
|
||||
|
|
|
@ -249,7 +249,7 @@ test('beforeAll/afterAll hooks are skipped when no tests in the suite are run 2'
|
|||
expect(result.output).not.toContain('%%afterAll');
|
||||
});
|
||||
|
||||
test('should run hooks after failure', async ({ runInlineTest }) => {
|
||||
test('run hooks after failure', async ({ runInlineTest }) => {
|
||||
const result = await runInlineTest({
|
||||
'a.test.js': `
|
||||
const { test } = pwt;
|
||||
|
|
Загрузка…
Ссылка в новой задаче