-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix else block transition update (#5591)
- Loading branch information
Showing
4 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> | ||
`); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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} |