From f65d56b0274d30ef693535c6abf549acfc16b6e6 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sat, 5 May 2018 11:12:48 -0400 Subject: [PATCH] failing test for #956 --- .../transition-js-await-block/_config.js | 32 +++++++++++++++++++ .../transition-js-await-block/main.html | 22 +++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 test/runtime/samples/transition-js-await-block/_config.js create mode 100644 test/runtime/samples/transition-js-await-block/main.html diff --git a/test/runtime/samples/transition-js-await-block/_config.js b/test/runtime/samples/transition-js-await-block/_config.js new file mode 100644 index 0000000000..fd879a12b3 --- /dev/null +++ b/test/runtime/samples/transition-js-await-block/_config.js @@ -0,0 +1,32 @@ +let fulfil; +let reject; + +let promise = new Promise((f, r) => { + fulfil = f; + reject = r; +}); + +export default { + data: { + promise + }, + + test(assert, component, target, window, raf) { + component.set({ visible: true }); + let p = target.querySelector('p'); + + assert.equal(p.className, 'pending'); + assert.equal(p.foo, 0); + + raf.tick(50); + assert.equal(p.foo, 0); + + fulfil(42); + raf.tick(80); + let ps = document.querySelectorAll('p'); + assert.equal(p[0].className, 'pending'); + assert.equal(p[1].className, 'then'); + assert.equal(p[0].foo, 20); + assert.equal(p[1].foo, 30); + }, +}; diff --git a/test/runtime/samples/transition-js-await-block/main.html b/test/runtime/samples/transition-js-await-block/main.html new file mode 100644 index 0000000000..9fc038fd66 --- /dev/null +++ b/test/runtime/samples/transition-js-await-block/main.html @@ -0,0 +1,22 @@ +{#await promise} +

loading...

+{:then value} +

{value}

+{:catch error} +

{error.message}

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