Fixed bug with slot props variables

pull/3122/head
Primo Sabatini 6 years ago
parent 7bc2ea811b
commit cc876eac19

@ -311,6 +311,9 @@ export default function dom(
const reactive_stores = component.vars.filter(variable => variable.name[0] === '$' && variable.name[1] !== '$');
if (component.slots.size > 0) {
component.vars.map(v => {
if (v.hoistable) filtered_declarations.push(v.name);
});
filtered_declarations.push('$$slots', '$$scope');
}

@ -0,0 +1,7 @@
<script>
let fooText = 'foo';
</script>
<div>
<slot someText={fooText}></slot>
</div>

@ -0,0 +1,20 @@
export default {
html: `
<div>
<p>foo</p>
</div>
`,
async test({ assert, target, window }) {
const div = target.querySelector('div');
const click = new window.MouseEvent('click');
await div.dispatchEvent(click);
assert.htmlEqual(target.innerHTML, `
<div>
<p>foo</p>
</div>
`);
}
};

@ -0,0 +1,7 @@
<script>
import Nested from './Nested.svelte';
</script>
<Nested let:someText={someText}>
<p>{someText}</p>
</Nested>
Loading…
Cancel
Save