mirror of https://github.com/sveltejs/svelte
parent
2784ae0ade
commit
4fa776561d
@ -0,0 +1,23 @@
|
|||||||
|
export default {
|
||||||
|
test ( assert, component, target, window ) {
|
||||||
|
let now = 0;
|
||||||
|
let callback;
|
||||||
|
|
||||||
|
window.performance = { now: () => now };
|
||||||
|
window.requestAnimationFrame = cb => callback = cb;
|
||||||
|
|
||||||
|
component.set({ visible: true });
|
||||||
|
const div = target.querySelector( 'div' );
|
||||||
|
assert.equal( window.getComputedStyle( div ).opacity, 0 );
|
||||||
|
|
||||||
|
now = 200;
|
||||||
|
callback();
|
||||||
|
assert.equal( window.getComputedStyle( div ).opacity, 0.5 );
|
||||||
|
|
||||||
|
now = 400;
|
||||||
|
callback();
|
||||||
|
assert.equal( window.getComputedStyle( div ).opacity, 1 );
|
||||||
|
|
||||||
|
component.destroy();
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,3 @@
|
|||||||
|
{{#if visible}}
|
||||||
|
<div in:style='{opacity: 0}'>fades in</div>
|
||||||
|
{{/if}}
|
Loading…
Reference in new issue