diff --git a/src/shared/utils.js b/src/shared/utils.js index 436782dcf6..c431a673f8 100644 --- a/src/shared/utils.js +++ b/src/shared/utils.js @@ -15,6 +15,7 @@ export function isPromise(value) { } export function callAfter(fn, i) { + if (i === 0) fn(); return () => { if (!--i) fn(); }; diff --git a/test/runtime/samples/each-block-empty-outro/Thing.html b/test/runtime/samples/each-block-empty-outro/Thing.html new file mode 100644 index 0000000000..150c8fd252 --- /dev/null +++ b/test/runtime/samples/each-block-empty-outro/Thing.html @@ -0,0 +1 @@ +

{thing}

\ No newline at end of file diff --git a/test/runtime/samples/each-block-empty-outro/_config.js b/test/runtime/samples/each-block-empty-outro/_config.js new file mode 100644 index 0000000000..443371892b --- /dev/null +++ b/test/runtime/samples/each-block-empty-outro/_config.js @@ -0,0 +1,20 @@ +export default { + data: { + visible: true, + empty: [] + }, + + html: ` +
+

text

+
+ `, + + nestedTransitions: true, + + test(assert, component, target) { + component.set({ visible: false }); + + assert.htmlEqual(target.innerHTML, ``); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/each-block-empty-outro/main.html b/test/runtime/samples/each-block-empty-outro/main.html new file mode 100644 index 0000000000..b5d1b95260 --- /dev/null +++ b/test/runtime/samples/each-block-empty-outro/main.html @@ -0,0 +1,17 @@ +{#if visible} +
+ {#each empty as thing} + + {/each} + +

text

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