mount await blocks with siblings (#974), and unmount correctly (#975)

pull/980/head
Rich Harris 7 years ago
parent a6836bd395
commit 978e628e67

@ -67,7 +67,7 @@ export default function visitAwaitBlock(
${old_block}.u();
${old_block}.d();
${await_block}.c();
${await_block}.m(${anchor}.parentNode, ${anchor});
${await_block}.m(${state.parentNode || `${anchor}.parentNode`}, ${anchor});
}
}
@ -142,6 +142,10 @@ export default function visitAwaitBlock(
`);
}
block.builders.unmount.addBlock(deindent`
${await_block}.u();
`);
block.builders.destroy.addBlock(deindent`
${await_token} = null;
${await_block}.d();

@ -1,6 +1,6 @@
let fulfil;
let thePromise = new Promise(f => {
const thePromise = new Promise(f => {
fulfil = f;
});
@ -35,9 +35,11 @@ export default {
show: true
});
assert.htmlEqual(target.innerHTML, `
<p>the value is 42</p>
`);
return thePromise.then(() => {
assert.htmlEqual(target.innerHTML, `
<p>the value is 42</p>
`);
});
});
}
};

Loading…
Cancel
Save