From 6437d7bfa779499a1d545afe958be8e616f6e97d Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sat, 5 May 2018 13:38:54 -0400 Subject: [PATCH] failing test for #1417 --- .../await-then-catch-static/_config.js | 48 +++++++++++++++++++ .../samples/await-then-catch-static/main.html | 7 +++ 2 files changed, 55 insertions(+) create mode 100644 test/runtime/samples/await-then-catch-static/_config.js create mode 100644 test/runtime/samples/await-then-catch-static/main.html diff --git a/test/runtime/samples/await-then-catch-static/_config.js b/test/runtime/samples/await-then-catch-static/_config.js new file mode 100644 index 000000000000..8029737d2761 --- /dev/null +++ b/test/runtime/samples/await-then-catch-static/_config.js @@ -0,0 +1,48 @@ +let fulfil; + +let promise = new Promise(f => { + fulfil = f; +}); + +export default { + solo: 1, + data: { + promise + }, + + html: ` +

loading...

+ `, + + test(assert, component, target) { + fulfil(42); + + return promise + .then(() => { + assert.htmlEqual(target.innerHTML, ` +

loaded

+ `); + + promise = new Promise((f, r) => { + fulfil = f; + }); + + component.set({ + promise + }); + + assert.htmlEqual(target.innerHTML, ` +

loading...

+ `); + + fulfil(43); + + return promise.then(() => {}); + }) + .then(() => { + assert.htmlEqual(target.innerHTML, ` +

loaded

+ `); + }); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/await-then-catch-static/main.html b/test/runtime/samples/await-then-catch-static/main.html new file mode 100644 index 000000000000..b420fe969cc8 --- /dev/null +++ b/test/runtime/samples/await-then-catch-static/main.html @@ -0,0 +1,7 @@ +{#await promise} +

loading...

+{:then value} +

loaded

+{:catch error} +

errored

+{/await} \ No newline at end of file