mirror of
https://github.com/sveltejs/svelte.git
synced 2024-12-01 17:30:59 +01:00
failing test for #956
This commit is contained in:
parent
9883fb67da
commit
f65d56b027
32
test/runtime/samples/transition-js-await-block/_config.js
Normal file
32
test/runtime/samples/transition-js-await-block/_config.js
Normal file
@ -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);
|
||||
},
|
||||
};
|
22
test/runtime/samples/transition-js-await-block/main.html
Normal file
22
test/runtime/samples/transition-js-await-block/main.html
Normal file
@ -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…
Reference in New Issue
Block a user