let fulfil; let thePromise = new Promise(f => { fulfil = f; }); export default { props: { thePromise }, html: `
loading...
`, test({ assert, component, target, window }) { fulfil(42); return thePromise .then(async () => { assert.htmlEqual(target.innerHTML, ` `); const { button } = component; const click = new window.MouseEvent('click'); button.dispatchEvent(click); assert.equal(component.clicked, 42); thePromise = Promise.resolve(43); component.thePromise = thePromise; return thePromise; }) .then(() => { const { button } = component; const click = new window.MouseEvent('click'); button.dispatchEvent(click); assert.equal(component.clicked, 43); }); } };