fix slot fallback update parent (#4598)

pull/4738/head
Tan Li Hau 4 years ago committed by GitHub
parent 7b74e84ca7
commit 2bf8fc7e6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -6,6 +6,7 @@
* Try using `globalThis` rather than `globals` for the benefit of non-Node servers and web workers ([#3561](https://github.com/sveltejs/svelte/issues/3561), [#4545](https://github.com/sveltejs/svelte/issues/4545))
* Support `{#await ... catch ...}` syntax shorthand ([#3623](https://github.com/sveltejs/svelte/issues/3623))
* Fix attaching of JS debugging comments to HTML comments ([#4565](https://github.com/sveltejs/svelte/issues/4565))
* Fix `<svelte:component/>` within `<slot/>` ([#4597](https://github.com/sveltejs/svelte/issues/4597))
* Fix issues with `<input type="number">` updates ([#4631](https://github.com/sveltejs/svelte/issues/4631), [#4687](https://github.com/sveltejs/svelte/issues/4687))
* Prevent illegal attribute names ([#4648](https://github.com/sveltejs/svelte/issues/4648))
* Fix `{#if}` block directly within `<slot/>` ([#4703](https://github.com/sveltejs/svelte/issues/4703))

@ -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