From e41a8ea3aa75dba5bb5d7ee20facbf7d3fe0d36d Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Sun, 16 Nov 2025 13:29:41 +0100 Subject: [PATCH] add commented-out test, todo investigate --- .../samples/async-each-overlap/_config.js | 102 ++++++++++++++++++ .../samples/async-each-overlap/main.svelte | 48 +++++++++ 2 files changed, 150 insertions(+) create mode 100644 packages/svelte/tests/runtime-runes/samples/async-each-overlap/_config.js create mode 100644 packages/svelte/tests/runtime-runes/samples/async-each-overlap/main.svelte diff --git a/packages/svelte/tests/runtime-runes/samples/async-each-overlap/_config.js b/packages/svelte/tests/runtime-runes/samples/async-each-overlap/_config.js new file mode 100644 index 0000000000..d03f9ad09d --- /dev/null +++ b/packages/svelte/tests/runtime-runes/samples/async-each-overlap/_config.js @@ -0,0 +1,102 @@ +import { tick } from 'svelte'; +import { test } from '../../test'; + +export default test({ + skip: true, + async test({ assert, target }) { + const [add, shift] = target.querySelectorAll('button'); + + add.click(); + await tick(); + add.click(); + await tick(); + add.click(); + await tick(); + + // TODO pending count / number of pushes is off + + assert.htmlEqual( + target.innerHTML, + ` + + +

pending=6 values.length=1 values=[1]

+
not keyed: +
1
+
+
keyed: +
1
+
+ ` + ); + + shift.click(); + await tick(); + shift.click(); + await tick(); + assert.htmlEqual( + target.innerHTML, + ` + + +

pending=4 values.length=2 values=[1,2]

+
not keyed: +
1
+
2
+
+
keyed: +
1
+
2
+
+ ` + ); + + shift.click(); + await tick(); + shift.click(); + await tick(); + assert.htmlEqual( + target.innerHTML, + ` + + +

pending=2 values.length=3 values=[1,2,3]

+
not keyed: +
1
+
2
+
3
+
+
keyed: +
1
+
2
+
3
+
+ ` + ); + + shift.click(); + await tick(); + shift.click(); + await tick(); + assert.htmlEqual( + target.innerHTML, + ` + + +

pending=0 values.length=4 values=[1,2,3,4]

+
not keyed: +
1
+
2
+
3
+
4
+
+
keyed: +
1
+
2
+
3
+
4
+
+ ` + ); + } +}); diff --git a/packages/svelte/tests/runtime-runes/samples/async-each-overlap/main.svelte b/packages/svelte/tests/runtime-runes/samples/async-each-overlap/main.svelte new file mode 100644 index 0000000000..af9d395457 --- /dev/null +++ b/packages/svelte/tests/runtime-runes/samples/async-each-overlap/main.svelte @@ -0,0 +1,48 @@ + + + + + +

+ pending={$effect.pending()} + values.length={values.length} + values=[{values}] +

+ +
+ not keyed: + {#each values as v} +
+ {await push(v)} +
+ {/each} +
+
+ keyed: + {#each values as v(v)} +
+ {await push(v)} +
+ {/each} +