You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/runtime/samples/await-then-destruct-object-if/_config.js

30 lines
458 B

export default {
props: {
thePromise: Promise.resolve({ result: 1 })
},
html: '',
async test({ assert, component, target }) {
await (component.thePromise = Promise.resolve({ result: 1 }));
assert.htmlEqual(
target.innerHTML,
`
<p>result: 1</p>
<p>count: 0</p>
`
);
await new Promise(resolve => setTimeout(resolve, 1));
assert.htmlEqual(
target.innerHTML,
`
<p>result: 1</p>
<p>count: 1</p>
`
);
}
};