forked from sveltejs/svelte
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_config.js
37 lines (30 loc) · 964 Bytes
/
_config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
export default {
props: {
x: false,
y: 1
},
test({ assert, component, target, raf }) {
component.x = true;
let div = target.querySelector('div');
assert.equal(div.foo, undefined);
// play both in and out transition when changed with `{#key}`
component.y = 2;
assert.htmlEqual(target.innerHTML, '<div></div><div></div>');
const [leaving, incoming] = target.querySelectorAll('div');
raf.tick(50);
assert.equal(leaving.foo, 0.5);
assert.equal(incoming.foo, 0.5);
raf.tick(100);
assert.htmlEqual(target.innerHTML, '<div></div>');
assert.equal(leaving.foo, 0);
assert.equal(incoming.foo, 1);
// do not play out transition when removed by `{#if}`
component.x = false;
assert.htmlEqual(target.innerHTML, '');
// do not play in transition when added back with `{#if}`
component.x = true;
assert.htmlEqual(target.innerHTML, '<div></div>');
div = target.querySelector('div');
assert.equal(div.foo, undefined);
}
};