mirror of https://github.com/sveltejs/svelte
fix slot fallback update parent (#4598)
parent
7b74e84ca7
commit
2bf8fc7e6b
@ -0,0 +1 @@
|
||||
Icon A
|
@ -0,0 +1 @@
|
||||
Icon B
|
@ -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…
Reference in new issue