mirror of https://github.com/sveltejs/svelte
added test for async block ordering (#1440)
parent
28dd6a899a
commit
0e586e39e3
@ -0,0 +1,27 @@
|
||||
let fulfil;
|
||||
|
||||
let thePromise = new Promise(f => {
|
||||
fulfil = f;
|
||||
});
|
||||
|
||||
export default {
|
||||
data: {
|
||||
thePromise
|
||||
},
|
||||
|
||||
html: `
|
||||
<p>loading...</p><p>true!</p>
|
||||
`,
|
||||
|
||||
test(assert, component, target) {
|
||||
fulfil(42);
|
||||
|
||||
return thePromise
|
||||
.then(() => {
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<p>the value is 42</p><p>true!</p>
|
||||
`);
|
||||
});
|
||||
|
||||
}
|
||||
};
|
@ -0,0 +1,11 @@
|
||||
{#await thePromise}
|
||||
<p>loading...</p>
|
||||
{:then theValue}
|
||||
<p>the value is {theValue}</p>
|
||||
{:catch theError}
|
||||
<p>oh no! {theError.message}</p>
|
||||
{/await}
|
||||
|
||||
{#if true}
|
||||
<p>true!</p>
|
||||
{/if}
|
Loading…
Reference in new issue