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-array/_config.js

29 lines
485 B

export default {
props: {
thePromise: new Promise(resolve => {}),
},
html: `
loading...
`,
async test({ assert, component, target }) {
let promise = Promise.resolve([1, 2]);
component.thePromise = promise;
await promise;
assert.htmlEqual(target.innerHTML, `
<p>a: 1</p>
<p>b: 2</p>
`);
promise = Promise.resolve([4, 5]);
component.thePromise = promise;
await promise;
assert.htmlEqual(target.innerHTML, `
<p>a: 4</p>
<p>b: 5</p>
`);
}
};