failing test for #956

pull/1420/head
Rich Harris 6 years ago
parent 9883fb67da
commit f65d56b027

@ -0,0 +1,32 @@
let fulfil;
let reject;
let promise = new Promise((f, r) => {
fulfil = f;
reject = r;
});
export default {
data: {
promise
},
test(assert, component, target, window, raf) {
component.set({ visible: true });
let p = target.querySelector('p');
assert.equal(p.className, 'pending');
assert.equal(p.foo, 0);
raf.tick(50);
assert.equal(p.foo, 0);
fulfil(42);
raf.tick(80);
let ps = document.querySelectorAll('p');
assert.equal(p[0].className, 'pending');
assert.equal(p[1].className, 'then');
assert.equal(p[0].foo, 20);
assert.equal(p[1].foo, 30);
},
};

@ -0,0 +1,22 @@
{#await promise}
<p class='pending' transition:foo>loading...</p>
{:then value}
<p class='then' transition:foo>{value}</p>
{:catch error}
<p class='catch' transition:foo>{error.message}</p>
{/await}
<script>
export default {
transitions: {
foo(node, params) {
return {
duration: 100,
tick: t => {
node.foo = t;
}
};
}
}
};
</script>
Loading…
Cancel
Save