mirror of https://github.com/sveltejs/svelte
parent
1f6d0221e2
commit
7f258bec71
@ -0,0 +1,20 @@
|
||||
export default {
|
||||
test({ assert, component, target, window, raf }) {
|
||||
component.visible = true;
|
||||
const div = target.querySelector('div');
|
||||
|
||||
assert.equal(div.style.animation, `__svelte_3809512021_0 100ms linear 0ms 1 both`);
|
||||
|
||||
raf.tick(50);
|
||||
component.visible = false;
|
||||
|
||||
// both in and out styles
|
||||
assert.equal(div.style.animation, `__svelte_3809512021_0 100ms linear 0ms 1 both, __svelte_3750847757_0 100ms linear 0ms 1 both`);
|
||||
|
||||
raf.tick(75);
|
||||
component.visible = true;
|
||||
|
||||
// reset original styles
|
||||
assert.equal(div.style.animation, `__svelte_3809512021_1 100ms linear 0ms 1 both`);
|
||||
},
|
||||
};
|
@ -0,0 +1,25 @@
|
||||
<script>
|
||||
export let visible;
|
||||
|
||||
function foo() {
|
||||
return {
|
||||
duration: 100,
|
||||
css: t => {
|
||||
return `opacity: ${t}`;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function bar() {
|
||||
return {
|
||||
duration: 100,
|
||||
css: t => {
|
||||
return `opacity: ${t}`;
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if visible}
|
||||
<div in:foo out:bar></div>
|
||||
{/if}
|
Loading…
Reference in new issue