diff --git a/packages/svelte/tests/runtime-runes/samples/async-overlapping-array-2/_config.js b/packages/svelte/tests/runtime-runes/samples/async-overlapping-array-2/_config.js new file mode 100644 index 0000000000..ff11893334 --- /dev/null +++ b/packages/svelte/tests/runtime-runes/samples/async-overlapping-array-2/_config.js @@ -0,0 +1,62 @@ +import { tick } from 'svelte'; +import { test } from '../../test'; + +export default test({ + async test({ assert, target, logs }) { + await tick(); + + const [increment, shift] = target.querySelectorAll('button'); + + assert.htmlEqual( + target.innerHTML, + ` + + +
1
+
2
+
3
+ ` + ); + + assert.deepEqual(logs, ['updating']); + + increment.click(); + await tick(); + increment.click(); + await tick(); + + assert.deepEqual(logs, ['updating', 'updating', 'updating']); + + shift.click(); + shift.click(); + shift.click(); + await tick(); + + assert.htmlEqual( + target.innerHTML, + ` + + +
2
+
3
+
4
+ ` + ); + + shift.click(); + shift.click(); + shift.click(); + await tick(); + + assert.htmlEqual( + target.innerHTML, + ` + + +
3
+
4
+
5
+ ` + ); + } +}); diff --git a/packages/svelte/tests/runtime-runes/samples/async-overlapping-array-2/main.svelte b/packages/svelte/tests/runtime-runes/samples/async-overlapping-array-2/main.svelte new file mode 100644 index 0000000000..08a2ab110b --- /dev/null +++ b/packages/svelte/tests/runtime-runes/samples/async-overlapping-array-2/main.svelte @@ -0,0 +1,32 @@ + + + + + +{#each array as item} +
{await push(item)}
+{/each}