test(ct): component as slot (#18090)

This commit is contained in:
sand4rt 2022-10-24 21:31:35 +02:00 committed by GitHub
parent cfad84cbca
commit 3460f01b47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 0 deletions

View file

@ -70,6 +70,13 @@ test('render a default child', async ({ mount }) => {
await expect(component).toContainText('Main Content')
})
test('render a component as slot', async ({ mount }) => {
const component = await mount(<DefaultChildren>
<Button title="Submit" />
</DefaultChildren>)
await expect(component).toContainText('Submit')
});
test('render multiple children', async ({ mount }) => {
const component = await mount(<DefaultChildren>
<div id="one">One</div>

View file

@ -73,6 +73,13 @@ test('render a default child', async ({ mount }) => {
await expect(component).toContainText('Main Content')
})
test('render a component as slot', async ({ mount }) => {
const component = await mount(<DefaultChildren>
<Button title="Submit" />
</DefaultChildren>)
await expect(component).toContainText('Submit')
})
test('render multiple children', async ({ mount }) => {
const component = await mount(<DefaultChildren>
<div id="one">One</div>

View file

@ -98,6 +98,14 @@ test('render multiple children', async ({ mount }) => {
await expect(component.locator('#two')).toContainText('Two');
});
test('render a component as slot', async ({ mount }) => {
const component = await mount(<DefaultChildren>
<Button title="Submit" />
</DefaultChildren>)
await expect(component).toContainText('Submit')
});
test('render named children', async ({ mount }) => {
const component = await mount(
<MultipleChildren>

View file

@ -46,6 +46,13 @@ test('render a default slot', async ({ mount }) => {
await expect(component).toContainText('Main Content')
})
test('render a component as slot', async ({ mount }) => {
const component = await mount(<DefaultSlot>
<Button title="Submit" />
</DefaultSlot>)
await expect(component).toContainText('Submit')
});
test('render a component with multiple children', async ({ mount }) => {
const component = await mount(<DefaultSlot>
<div id="one">One</div>

View file

@ -75,6 +75,13 @@ test('render a default slot', async ({ mount }) => {
await expect(component.getByRole('strong')).toContainText('Main Content')
})
test('render a component as slot', async ({ mount }) => {
const component = await mount(<DefaultSlot>
<Button title="Submit" />
</DefaultSlot>)
await expect(component).toContainText('Submit')
});
test('render a component with multiple slots', async ({ mount }) => {
const component = await mount(<DefaultSlot>
<div data-testid="one">One</div>

View file

@ -76,6 +76,13 @@ test('render a default slot', async ({ mount }) => {
await expect(component).toContainText('Main Content')
})
test('render a component as slot', async ({ mount }) => {
const component = await mount(<DefaultSlot>
<Button title="Submit" />
</DefaultSlot>)
await expect(component).toContainText('Submit')
});
test('render a component with multiple slots', async ({ mount }) => {
const component = await mount(<DefaultSlot>
<div id="one">One</div>