mirror of https://github.com/sveltejs/svelte
parent
3433418dce
commit
468938c573
@ -0,0 +1,25 @@
|
||||
let fulfil;
|
||||
|
||||
const thePromise = new Promise(f => {
|
||||
fulfil = f;
|
||||
});
|
||||
|
||||
export default {
|
||||
props: {
|
||||
thePromise
|
||||
},
|
||||
|
||||
html: `
|
||||
loading...
|
||||
`,
|
||||
|
||||
async test({ assert, component, target }) {
|
||||
fulfil([]);
|
||||
|
||||
await thePromise;
|
||||
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<p>promise array is empty</p>
|
||||
`);
|
||||
}
|
||||
};
|
@ -0,0 +1,13 @@
|
||||
<script>
|
||||
export let thePromise;
|
||||
</script>
|
||||
|
||||
{#await thePromise}
|
||||
loading...
|
||||
{:then r}
|
||||
{#if r.length < 1}
|
||||
<p>promise array is empty</p>
|
||||
{:else}
|
||||
<p>promise array is not empty</p>
|
||||
{/if}
|
||||
{/await}
|
Loading…
Reference in new issue