mirror of https://github.com/sveltejs/svelte
fix nested block not reactive (#4294)
parent
e93c991362
commit
e4daaccd06
@ -0,0 +1,2 @@
|
||||
Display:
|
||||
<slot></slot>
|
@ -0,0 +1,6 @@
|
||||
<script>
|
||||
let val;
|
||||
</script>
|
||||
|
||||
<input bind:value={val} />
|
||||
<slot {val}></slot>
|
@ -0,0 +1,30 @@
|
||||
export default {
|
||||
html: `
|
||||
<input>
|
||||
`,
|
||||
async test({ assert, target, snapshot, component, window }) {
|
||||
const input = target.querySelector('input');
|
||||
|
||||
input.value = 'a';
|
||||
await input.dispatchEvent(new window.Event('input'));
|
||||
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
`
|
||||
<input>
|
||||
Display: a
|
||||
`
|
||||
);
|
||||
|
||||
input.value = 'abc';
|
||||
await input.dispatchEvent(new window.Event('input'));
|
||||
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
`
|
||||
<input>
|
||||
Display: abc
|
||||
`
|
||||
);
|
||||
},
|
||||
};
|
@ -0,0 +1,10 @@
|
||||
<script>
|
||||
import Input from "./Input.svelte";
|
||||
import Display from "./Display.svelte";
|
||||
</script>
|
||||
|
||||
<Input let:val={foo}>
|
||||
{#if foo}
|
||||
<Display>{foo}</Display>
|
||||
{/if}
|
||||
</Input>
|
Loading…
Reference in new issue