mirror of https://github.com/sveltejs/svelte
parent
a043c4414a
commit
7cab338e32
@ -0,0 +1,22 @@
|
||||
export default {
|
||||
test ( assert, component, target, window, raf ) {
|
||||
component.set({ visible: true });
|
||||
const div = target.querySelector('div');
|
||||
|
||||
component.set({ visible: false });
|
||||
assert.equal(window.getComputedStyle(div).opacity, 1);
|
||||
|
||||
raf.tick(200);
|
||||
assert.equal(window.getComputedStyle(div).opacity, 0.5);
|
||||
component.set({ blabla: false });
|
||||
|
||||
raf.tick(400);
|
||||
assert.equal(window.getComputedStyle(div).opacity, 0);
|
||||
|
||||
raf.tick(600);
|
||||
assert.equal(component.refs.div, undefined);
|
||||
assert.equal(target.querySelector('div'), undefined);
|
||||
|
||||
component.destroy();
|
||||
}
|
||||
};
|
@ -0,0 +1,18 @@
|
||||
{#if visible}
|
||||
<div out:fade style="opacity: 1;" ref:div>yes</div>
|
||||
{/if}
|
||||
|
||||
<script>
|
||||
export default {
|
||||
transitions: {
|
||||
fade: function ( node, params ) {
|
||||
return {
|
||||
duration: 400,
|
||||
tick: t => {
|
||||
node.style.opacity = t;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in new issue