mirror of https://github.com/sveltejs/svelte
fix else block transition update (#5591)
parent
169fd8497c
commit
148b6105ed
@ -0,0 +1,31 @@
|
||||
// expect aborting halfway through outro transition
|
||||
// to behave the same in `{#if}` block as in `{:else}` block
|
||||
export default {
|
||||
html: `
|
||||
<div>a</div>
|
||||
|
||||
<div>a</div>
|
||||
`,
|
||||
|
||||
async test({ assert, component, target, window, raf }) {
|
||||
component.visible = false;
|
||||
|
||||
// abort halfway through the outro transition
|
||||
raf.tick(50);
|
||||
|
||||
await component.$set({
|
||||
visible: true,
|
||||
array: ['a', 'b', 'c']
|
||||
});
|
||||
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<div>a</div>
|
||||
<div>b</div>
|
||||
<div>c</div>
|
||||
|
||||
<div>a</div>
|
||||
<div>b</div>
|
||||
<div>c</div>
|
||||
`);
|
||||
}
|
||||
};
|
@ -0,0 +1,21 @@
|
||||
<script>
|
||||
export let array = ['a'];
|
||||
export let visible = true;
|
||||
|
||||
function slide(_, params) {
|
||||
return params;
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if visible}
|
||||
{#each array as item}
|
||||
<div transition:slide={{duration:100}}>{item}</div>
|
||||
{/each}
|
||||
{/if}
|
||||
|
||||
{#if !visible}
|
||||
{:else}
|
||||
{#each array as item}
|
||||
<div transition:slide={{duration:100}}>{item}</div>
|
||||
{/each}
|
||||
{/if}
|
Loading…
Reference in new issue