fix order of html tags when if in key block

pull/5685/head
Tan Li Hau 5 years ago
parent 148b6105ed
commit 002ffa208d

@ -44,7 +44,7 @@ export default class KeyBlockWrapper extends Wrapper {
renderer, renderer,
this.block, this.block,
node.children, node.children,
parent, this,
strip_whitespace, strip_whitespace,
next_sibling next_sibling
); );

@ -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…
Cancel
Save