mirror of https://github.com/sveltejs/svelte
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
572 B
26 lines
572 B
8 years ago
|
export default {
|
||
|
test ( assert, component, target, window ) {
|
||
|
let now = 0;
|
||
|
let callback;
|
||
|
|
||
|
window.performance = { now: () => now };
|
||
8 years ago
|
global.requestAnimationFrame = cb => callback = cb;
|
||
8 years ago
|
|
||
|
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 );
|
||
|
|
||
8 years ago
|
now = 500;
|
||
|
callback();
|
||
|
|
||
8 years ago
|
component.destroy();
|
||
|
}
|
||
|
};
|