-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apply delays to bidirectional transitions - fixes #562
- Loading branch information
1 parent
90d2e7f
commit 1a92398
Showing
8 changed files
with
160 additions
and
43 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
24 changes: 24 additions & 0 deletions
24
test/runtime/samples/transition-js-delay-in-out/_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 { | ||
test ( assert, component, target, window, raf ) { | ||
component.set({ visible: true }); | ||
const div = target.querySelector( 'div' ); | ||
assert.equal( div.foo, 0 ); | ||
|
||
raf.tick( 50 ); | ||
assert.equal( div.foo, 0 ); | ||
|
||
raf.tick( 150 ); | ||
assert.equal( div.foo, 1 ); | ||
|
||
component.set({ visible: false }); | ||
assert.equal( div.bar, undefined ); | ||
|
||
raf.tick( 200 ); | ||
assert.equal( div.bar, 1 ); | ||
|
||
raf.tick( 300 ); | ||
assert.equal( div.bar, 0 ); | ||
|
||
component.destroy(); | ||
} | ||
}; |
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,29 @@ | ||
{{#if visible}} | ||
<div in:foo out:bar>delayed</div> | ||
{{/if}} | ||
|
||
<script> | ||
export default { | ||
transitions: { | ||
foo: function ( node, params ) { | ||
return { | ||
delay: 50, | ||
duration: 100, | ||
tick: t => { | ||
node.foo = t; | ||
} | ||
}; | ||
}, | ||
|
||
bar: function ( node, params ) { | ||
return { | ||
delay: 50, | ||
duration: 100, | ||
tick: t => { | ||
node.bar = t; | ||
} | ||
}; | ||
} | ||
} | ||
}; | ||
</script> |
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,29 @@ | ||
export default { | ||
test ( assert, component, target, window, raf ) { | ||
component.set({ visible: true }); | ||
const div = target.querySelector( 'div' ); | ||
assert.equal( div.foo, 0 ); | ||
|
||
raf.tick( 50 ); | ||
assert.equal( div.foo, 0 ); | ||
|
||
raf.tick( 100 ); | ||
assert.equal( div.foo, 0.5 ); | ||
|
||
component.set({ visible: false }); | ||
|
||
raf.tick( 125 ); | ||
assert.equal( div.foo, 0.75 ); | ||
|
||
raf.tick( 150 ); | ||
assert.equal( div.foo, 1 ); | ||
|
||
raf.tick( 175 ); | ||
assert.equal( div.foo, 0.75 ); | ||
|
||
raf.tick( 250 ); | ||
assert.equal( div.foo, 0 ); | ||
|
||
component.destroy(); | ||
} | ||
}; |
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 @@ | ||
{{#if visible}} | ||
<div transition:foo>delayed</div> | ||
{{/if}} | ||
|
||
<script> | ||
export default { | ||
transitions: { | ||
foo: function ( node, params ) { | ||
return { | ||
delay: 50, | ||
duration: 100, | ||
tick: t => { | ||
node.foo = t; | ||
} | ||
}; | ||
} | ||
} | ||
}; | ||
</script> |
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