mirror of https://github.com/sveltejs/svelte
parent
24a338a4e8
commit
ca63111498
@ -0,0 +1,7 @@
|
||||
<h1>Foo</h1>
|
||||
<div id="default">
|
||||
<slot></slot>
|
||||
</div>
|
||||
<div id="other">
|
||||
<slot name='other'></slot>
|
||||
</div>
|
||||
@ -0,0 +1,29 @@
|
||||
export default {
|
||||
props: {
|
||||
x: true
|
||||
},
|
||||
|
||||
html: `
|
||||
<h1>Foo</h1>
|
||||
<div id="default">
|
||||
<h1>This is default slot</h1>
|
||||
</div>
|
||||
<div id="other">
|
||||
<h1 slot='other'>This is other slot</h1>
|
||||
</div>
|
||||
`,
|
||||
|
||||
test({ assert, component, target }) {
|
||||
component.tag = 'h2';
|
||||
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<h1>Foo</h1>
|
||||
<div id="default">
|
||||
<h2>This is default slot</h2>
|
||||
</div>
|
||||
<div id="other">
|
||||
<h2 slot='other'>This is other slot</h2>
|
||||
</div>
|
||||
`);
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,10 @@
|
||||
<script>
|
||||
import Foo from './Foo.svelte';
|
||||
export let tag = "h1";
|
||||
</script>
|
||||
|
||||
<Foo>
|
||||
<svelte:element this={tag}>This is default slot</svelte:element>
|
||||
<svelte:element this={tag} slot='other'>This is other slot</svelte:element>
|
||||
</Foo>
|
||||
|
||||
Loading…
Reference in new issue