fix slot fallback update parent

pull/4598/head
Tan Li Hau 6 years ago
parent 7b74e84ca7
commit 82b8267689

@ -0,0 +1,13 @@
<script>
import IconA from './IconA.svelte';
import IconB from './IconB.svelte';
let variable = false;
</script>
<button on:click={() => variable = !variable}>Click Me</button>
<div>
<slot>
<svelte:component this={variable ? IconA : IconB} />
</slot>
</div>

@ -0,0 +1,31 @@
export default {
html: `
<button>Click Me</button>
<div>Icon B</div>
`,
async test({ assert, target, window }) {
const btn = target.querySelector("button");
const clickEvent = new window.MouseEvent("click");
await btn.dispatchEvent(clickEvent);
assert.htmlEqual(
target.innerHTML,
`
<button>Click Me</button>
<div>Icon A</div>
`
);
await btn.dispatchEvent(clickEvent);
assert.htmlEqual(
target.innerHTML,
`
<button>Click Me</button>
<div>Icon B</div>
`
);
}
};

@ -0,0 +1,5 @@
<script>
import Inner from "./Inner.svelte";
</script>
<Inner></Inner>
Loading…
Cancel
Save