-
-
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.
Abort outro if block is recreated — fixes #1425
- Loading branch information
1 parent
e1db827
commit e8a7806
Showing
10 changed files
with
132 additions
and
16 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
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
39 changes: 39 additions & 0 deletions
39
test/runtime/samples/transition-js-aborted-outro-in-each/_config.js
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,39 @@ | ||
export default { | ||
data: { | ||
things: [ | ||
'one', | ||
'two', | ||
'three' | ||
] | ||
}, | ||
|
||
test(assert, component, target, window, raf) { | ||
const { things } = component.get(); | ||
|
||
component.set({ things: [] }); | ||
const spans = target.querySelectorAll('span'); | ||
|
||
raf.tick(25); | ||
assert.equal(spans[0].foo, 0.75); | ||
assert.equal(spans[1].foo, undefined); | ||
assert.equal(spans[2].foo, undefined); | ||
|
||
raf.tick(125); | ||
assert.equal(spans[0].foo, 0); | ||
assert.equal(spans[1].foo, 0.25); | ||
assert.equal(spans[2].foo, 0.75); | ||
|
||
component.set({ things }); | ||
raf.tick(225); | ||
|
||
assert.htmlEqual(target.innerHTML, ` | ||
<span>one</span> | ||
<span>two</span> | ||
<span>three</span> | ||
`); | ||
|
||
assert.equal(spans[0].foo, 1); | ||
assert.equal(spans[1].foo, 1); | ||
assert.equal(spans[2].foo, 1); | ||
}, | ||
}; |
19 changes: 19 additions & 0 deletions
19
test/runtime/samples/transition-js-aborted-outro-in-each/main.html
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,19 @@ | ||
{#each things as thing, i} | ||
<span out:foo="{delay: i * 50}">{thing}</span> | ||
{/each} | ||
|
||
<script> | ||
export default { | ||
transitions: { | ||
foo(node, params) { | ||
return { | ||
delay: params.delay, | ||
duration: 100, | ||
tick: t => { | ||
node.foo = t; | ||
} | ||
}; | ||
} | ||
} | ||
}; | ||
</script> |
24 changes: 24 additions & 0 deletions
24
test/runtime/samples/transition-js-aborted-outro/_config.js
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,24 @@ | ||
export default { | ||
data: { | ||
visible: true, | ||
}, | ||
|
||
test(assert, component, target, window, raf) { | ||
component.set({ visible: false }); | ||
const span = target.querySelector('span'); | ||
|
||
raf.tick(50); | ||
assert.equal(span.foo, 0.5); | ||
|
||
component.set({ visible: true }); | ||
assert.equal(span.foo, 1); | ||
|
||
raf.tick(75); | ||
assert.equal(span.foo, 1); | ||
|
||
raf.tick(100); | ||
assert.htmlEqual(target.innerHTML, ` | ||
<span>hello</span> | ||
`); | ||
}, | ||
}; |
18 changes: 18 additions & 0 deletions
18
test/runtime/samples/transition-js-aborted-outro/main.html
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,18 @@ | ||
{#if visible} | ||
<span out:foo>hello</span> | ||
{/if} | ||
|
||
<script> | ||
export default { | ||
transitions: { | ||
foo(node, params) { | ||
return { | ||
duration: 100, | ||
tick: t => { | ||
node.foo = t; | ||
} | ||
}; | ||
} | ||
} | ||
}; | ||
</script> |