From 2d5bf242a9742a76c5bea7ed7720d252ce985d43 Mon Sep 17 00:00:00 2001 From: Jesse Skinner Date: Thu, 15 Oct 2020 15:52:59 -0400 Subject: [PATCH] add failing test for issue #5508 --- .../_config.js | 29 +++++++++++++++++++ .../main.svelte | 19 ++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 test/runtime/samples/await-then-destruct-if-reactive/_config.js create mode 100644 test/runtime/samples/await-then-destruct-if-reactive/main.svelte diff --git a/test/runtime/samples/await-then-destruct-if-reactive/_config.js b/test/runtime/samples/await-then-destruct-if-reactive/_config.js new file mode 100644 index 0000000000..6a29b2db37 --- /dev/null +++ b/test/runtime/samples/await-then-destruct-if-reactive/_config.js @@ -0,0 +1,29 @@ +export default { + props: { + thePromise: Promise.resolve({ result: 1 }) + }, + + html: '', + + async test({ assert, component, target }) { + await (component.thePromise = Promise.resolve({ result: 1 })); + + assert.htmlEqual( + target.innerHTML, + ` +

result: 1

+

count: 0

+ ` + ); + + await new Promise(resolve => setTimeout(resolve, 1)); + + assert.htmlEqual( + target.innerHTML, + ` +

result: 1

+

count: 1

+ ` + ); + } +}; diff --git a/test/runtime/samples/await-then-destruct-if-reactive/main.svelte b/test/runtime/samples/await-then-destruct-if-reactive/main.svelte new file mode 100644 index 0000000000..3425979e2c --- /dev/null +++ b/test/runtime/samples/await-then-destruct-if-reactive/main.svelte @@ -0,0 +1,19 @@ + + +{#await thePromise then { result }} + {#if result} +

result: {result}

+

count: {count}

+ {:else} +

result: {result}

+

count: {count}

+ {/if} +{/await}