diff --git a/tests/components/ct-svelte-vite/src/components/NamedSlots.svelte b/tests/components/ct-svelte-vite/src/components/NamedSlots.svelte new file mode 100644 index 0000000000..5f0d988af5 --- /dev/null +++ b/tests/components/ct-svelte-vite/src/components/NamedSlots.svelte @@ -0,0 +1,11 @@ +
+
+ +
+
+ +
+ +
diff --git a/tests/components/ct-svelte-vite/src/tests.spec.ts b/tests/components/ct-svelte-vite/src/tests.spec.ts index 915c2dc205..c10344a8b6 100644 --- a/tests/components/ct-svelte-vite/src/tests.spec.ts +++ b/tests/components/ct-svelte-vite/src/tests.spec.ts @@ -17,6 +17,7 @@ import { test, expect } from '@playwright/experimental-ct-svelte'; import Button from './components/Button.svelte'; import DefaultSlot from './components/DefaultSlot.svelte'; +import NamedSlots from './components/NamedSlots.svelte'; import MultiRoot from './components/MultiRoot.svelte'; import Empty from './components/Empty.svelte'; @@ -54,6 +55,19 @@ test('render a default slot', async ({ mount }) => { await expect(component).toContainText('Main Content') }) +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') +}) + test('run hooks', async ({ page, mount }) => { const messages = [] page.on('console', m => messages.push(m.text())) diff --git a/tests/components/ct-svelte/src/components/NamedSlots.svelte b/tests/components/ct-svelte/src/components/NamedSlots.svelte new file mode 100644 index 0000000000..5f0d988af5 --- /dev/null +++ b/tests/components/ct-svelte/src/components/NamedSlots.svelte @@ -0,0 +1,11 @@ +
+
+ +
+
+ +
+ +
diff --git a/tests/components/ct-svelte/src/tests.spec.ts b/tests/components/ct-svelte/src/tests.spec.ts index 10419b8d98..60fcc94c3b 100644 --- a/tests/components/ct-svelte/src/tests.spec.ts +++ b/tests/components/ct-svelte/src/tests.spec.ts @@ -18,6 +18,7 @@ import { test, expect } from '@playwright/experimental-ct-svelte'; import Button from './components/Button.svelte'; import Component from './components/Component.svelte'; import DefaultSlot from './components/DefaultSlot.svelte'; +import NamedSlots from './components/NamedSlots.svelte' import MultiRoot from './components/MultiRoot.svelte'; import Empty from './components/Empty.svelte'; @@ -55,6 +56,19 @@ test('render a default slot', async ({ mount }) => { await expect(component).toContainText('Main Content') }) +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') +}) + test('render a component without options', async ({ mount }) => { const component = await mount(Component); await expect(component).toContainText('test');