-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
outro when <svelte:component> switches - #1568
- Loading branch information
1 parent
bec49a0
commit bde21da
Showing
5 changed files
with
93 additions
and
7 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
16 changes: 16 additions & 0 deletions
16
test/runtime/samples/transition-js-dynamic-component/A.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,16 @@ | ||
<div transition:a>a</div> | ||
|
||
<script> | ||
export default { | ||
transitions: { | ||
a(node, params) { | ||
return { | ||
duration: 100, | ||
tick: t => { | ||
node.a = t; | ||
} | ||
}; | ||
} | ||
} | ||
}; | ||
</script> |
16 changes: 16 additions & 0 deletions
16
test/runtime/samples/transition-js-dynamic-component/B.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,16 @@ | ||
<div transition:b>b</div> | ||
|
||
<script> | ||
export default { | ||
transitions: { | ||
b(node, params) { | ||
return { | ||
duration: 100, | ||
tick: t => { | ||
node.b = t; | ||
} | ||
}; | ||
} | ||
} | ||
}; | ||
</script> |
37 changes: 37 additions & 0 deletions
37
test/runtime/samples/transition-js-dynamic-component/_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,37 @@ | ||
export default { | ||
nestedTransitions: true, | ||
skipIntroByDefault: true, | ||
|
||
data: { | ||
x: true, | ||
}, | ||
|
||
html: ` | ||
<div>a</div> | ||
`, | ||
|
||
test (assert, component, target, window, raf) { | ||
component.set({ x: false }); | ||
|
||
assert.htmlEqual(target.innerHTML, ` | ||
<div>a</div> | ||
<div>b</div> | ||
`); | ||
|
||
const [a, b] = target.querySelectorAll('div'); | ||
|
||
raf.tick(25); | ||
|
||
assert.equal(a.a, 0.75); | ||
assert.equal(b.b, 0.25); | ||
|
||
raf.tick(100); | ||
|
||
assert.equal(a.a, 0); | ||
assert.equal(b.b, 1); | ||
|
||
assert.htmlEqual(target.innerHTML, ` | ||
<div>b</div> | ||
`); | ||
} | ||
}; |
12 changes: 12 additions & 0 deletions
12
test/runtime/samples/transition-js-dynamic-component/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,12 @@ | ||
<svelte:component this="{x ? A : B}"/> | ||
|
||
<script> | ||
import A from './A.html'; | ||
import B from './B.html'; | ||
|
||
export default { | ||
data() { | ||
return { A, B }; | ||
} | ||
}; | ||
</script> |