mirror of https://github.com/sveltejs/svelte
fix allow let scoped to root element (#4266)
parent
bfff7a9d0e
commit
8b9b2c266e
@ -0,0 +1,5 @@
|
|||||||
|
<script>
|
||||||
|
export let x;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<slot name="foo" reflected={x}/>
|
@ -0,0 +1,22 @@
|
|||||||
|
export default {
|
||||||
|
html: `
|
||||||
|
<span slot="foo" class="1">1</span>
|
||||||
|
0
|
||||||
|
`,
|
||||||
|
async test({ assert, target, component, window }) {
|
||||||
|
component.x = 2;
|
||||||
|
|
||||||
|
assert.htmlEqual(target.innerHTML, `
|
||||||
|
<span slot="foo" class="2">2</span>
|
||||||
|
0
|
||||||
|
`);
|
||||||
|
|
||||||
|
const span = target.querySelector('span');
|
||||||
|
await span.dispatchEvent(new window.MouseEvent('click'));
|
||||||
|
|
||||||
|
assert.htmlEqual(target.innerHTML, `
|
||||||
|
<span slot="foo" class="2">2</span>
|
||||||
|
2
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,17 @@
|
|||||||
|
<script>
|
||||||
|
import A from './A.svelte';
|
||||||
|
export let x = 1;
|
||||||
|
let y = 0;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<A {x}>
|
||||||
|
<span
|
||||||
|
on:click={() => y = reflected}
|
||||||
|
slot="foo"
|
||||||
|
let:reflected
|
||||||
|
class={reflected}
|
||||||
|
>
|
||||||
|
{reflected}
|
||||||
|
</span>
|
||||||
|
</A>
|
||||||
|
{ y }
|
Loading…
Reference in new issue