Skip to content

Commit f65d56b

Browse files
committed
failing test for #956
1 parent 9883fb6 commit f65d56b

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
let fulfil;
2+
let reject;
3+
4+
let promise = new Promise((f, r) => {
5+
fulfil = f;
6+
reject = r;
7+
});
8+
9+
export default {
10+
data: {
11+
promise
12+
},
13+
14+
test(assert, component, target, window, raf) {
15+
component.set({ visible: true });
16+
let p = target.querySelector('p');
17+
18+
assert.equal(p.className, 'pending');
19+
assert.equal(p.foo, 0);
20+
21+
raf.tick(50);
22+
assert.equal(p.foo, 0);
23+
24+
fulfil(42);
25+
raf.tick(80);
26+
let ps = document.querySelectorAll('p');
27+
assert.equal(p[0].className, 'pending');
28+
assert.equal(p[1].className, 'then');
29+
assert.equal(p[0].foo, 20);
30+
assert.equal(p[1].foo, 30);
31+
},
32+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{#await promise}
2+
<p class='pending' transition:foo>loading...</p>
3+
{:then value}
4+
<p class='then' transition:foo>{value}</p>
5+
{:catch error}
6+
<p class='catch' transition:foo>{error.message}</p>
7+
{/await}
8+
9+
<script>
10+
export default {
11+
transitions: {
12+
foo(node, params) {
13+
return {
14+
duration: 100,
15+
tick: t => {
16+
node.foo = t;
17+
}
18+
};
19+
}
20+
}
21+
};
22+
</script>

0 commit comments

Comments
 (0)