mirror of https://github.com/sveltejs/svelte
fix order of html tags with {#if} in {#key} block (#5685)
parent
342c1e427c
commit
24c44b9177
@ -0,0 +1,21 @@
|
||||
export default {
|
||||
html: `
|
||||
<section>
|
||||
<div>Second</div>
|
||||
</section>
|
||||
<button>Click</button>
|
||||
`,
|
||||
async test({ assert, component, target, window }) {
|
||||
const button = target.querySelector('button');
|
||||
|
||||
await button.dispatchEvent(new window.Event('click'));
|
||||
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<section>
|
||||
<div>First</div>
|
||||
<div>Second</div>
|
||||
</section>
|
||||
<button>Click</button>
|
||||
`);
|
||||
}
|
||||
};
|
@ -0,0 +1,17 @@
|
||||
<script>
|
||||
let slide = 0;
|
||||
let num = false;
|
||||
|
||||
const changeNum = () => num = !num;
|
||||
</script>
|
||||
|
||||
<section>
|
||||
{#key slide}
|
||||
{#if num}
|
||||
<div>First</div>
|
||||
{/if}
|
||||
{/key}
|
||||
<div>Second</div>
|
||||
</section>
|
||||
|
||||
<button on:click={changeNum}>Click</button>
|
Loading…
Reference in new issue