mirror of https://github.com/sveltejs/svelte
parent
62e6d0654d
commit
868fb234ed
@ -1,19 +1,22 @@
|
|||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
|
import { tick } from 'svelte';
|
||||||
import Component from './main.svelte';
|
import Component from './main.svelte';
|
||||||
|
|
||||||
export default function (target) {
|
export default async function (target) {
|
||||||
const component = new Component({ target, props: { name: 'slot' } });
|
const component = new Component({ target, props: { name: 'slot' } });
|
||||||
|
await tick();
|
||||||
|
await tick();
|
||||||
|
|
||||||
const ce = target.querySelector('my-widget');
|
const ce = target.querySelector('my-widget');
|
||||||
|
|
||||||
assert.htmlEqual(ce.shadowRoot.innerHTML, `
|
assert.htmlEqual(ce.shadowRoot.innerHTML, `
|
||||||
<slot>fallback</slot>
|
<slot></slot>
|
||||||
<slot name=\"named\"><p>named fallback</p></slot>
|
<p>named fallback</p>
|
||||||
`);
|
`);
|
||||||
|
|
||||||
component.name = 'slot2';
|
component.name = 'slot2';
|
||||||
assert.htmlEqual(ce.shadowRoot.innerHTML, `
|
assert.htmlEqual(ce.shadowRoot.innerHTML, `
|
||||||
<slot>fallback</slot>
|
<slot></slot>
|
||||||
<slot name=\"named\"><p>named fallback</p></slot>
|
<p>named fallback</p>
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in new issue