36 lines
1 KiB
TypeScript
36 lines
1 KiB
TypeScript
import { test, expect } from '@playwright/experimental-ct-vue2';
|
|
import DefaultSlot from '@/components/DefaultSlot.vue';
|
|
import NamedSlots from '@/components/NamedSlots.vue';
|
|
|
|
test('render a default slot', async ({ mount }) => {
|
|
const component = await mount(DefaultSlot, {
|
|
slots: {
|
|
default: 'Main Content',
|
|
},
|
|
});
|
|
await expect(component).toContainText('Main Content');
|
|
});
|
|
|
|
test('render a component with multiple slots', async ({ mount }) => {
|
|
const component = await mount(DefaultSlot, {
|
|
slots: {
|
|
default: ['one', 'two'],
|
|
},
|
|
});
|
|
await expect(component).toContainText('one');
|
|
await expect(component).toContainText('two');
|
|
});
|
|
|
|
test('render a component with a named slot', async ({ mount }) => {
|
|
const component = await mount(NamedSlots, {
|
|
slots: {
|
|
header: 'Header',
|
|
main: 'Main Content',
|
|
footer: 'Footer',
|
|
},
|
|
});
|
|
await expect(component).toContainText('Header');
|
|
await expect(component).toContainText('Main Content');
|
|
await expect(component).toContainText('Footer');
|
|
});
|