Add first test for dynamic slots

pull/8535/head
Nguyen Tran 3 years ago
parent 8098b6bc7e
commit 3972cecf5e

@ -0,0 +1,13 @@
<script>
let slot = 'dynamic-slot';
const f = () => {
slot = 'thing';
}
</script>
<div>
<slot name={slot} />
<slot />
<slot name='static' />
</div>

@ -0,0 +1,9 @@
export default {
compileOptions: {
dev: true
},
html: '<div><p slot="dynamic-slot">Hello</p><p slot="default">Hello</p><p slot="static">Hello</p></div>',
warnings: ['<Nested> received an unexpected slot "dynamic-slot-again".']
};

@ -0,0 +1,16 @@
<script>
import Nested from './Nested.svelte';
let slot = 'dynamic-slot';
function y() {
slot = 'another-slot';
}
</script>
<Nested>
<p slot={slot}>Hello</p>
<p slot='default'>Hello</p>
<p slot='static'>Hello</p>
<p slot={`${slot}-again`}>Hello</p>
</Nested>
Loading…
Cancel
Save