diff --git a/packages/svelte/tests/runtime-runes/samples/async-state-eager-if/_config.js b/packages/svelte/tests/runtime-runes/samples/async-state-eager-if/_config.js new file mode 100644 index 0000000000..a1045ab363 --- /dev/null +++ b/packages/svelte/tests/runtime-runes/samples/async-state-eager-if/_config.js @@ -0,0 +1,57 @@ +import { tick } from 'svelte'; +import { test } from '../../test'; + +export default test({ + mode: ['client'], + + compileOptions: { + dev: true + }, + + async test({ assert, target }) { + const [count, shift] = target.querySelectorAll('button'); + + shift.click(); + await tick(); + assert.htmlEqual(target.innerHTML, `

0

`); + + count.click(); + await tick(); + assert.htmlEqual( + target.innerHTML, + `

0

updating

` + ); + + count.click(); + await tick(); + assert.htmlEqual( + target.innerHTML, + `

0

updating

` + ); + + count.click(); + await tick(); + assert.htmlEqual( + target.innerHTML, + `

0

updating

` + ); + + shift.click(); + await tick(); + assert.htmlEqual( + target.innerHTML, + `

1

updating

` + ); + + shift.click(); + await tick(); + assert.htmlEqual( + target.innerHTML, + `

2

updating

` + ); + + shift.click(); + await tick(); + assert.htmlEqual(target.innerHTML, `

3

`); + } +}); diff --git a/packages/svelte/tests/runtime-runes/samples/async-state-eager-if/main.svelte b/packages/svelte/tests/runtime-runes/samples/async-state-eager-if/main.svelte new file mode 100644 index 0000000000..5dee0c164d --- /dev/null +++ b/packages/svelte/tests/runtime-runes/samples/async-state-eager-if/main.svelte @@ -0,0 +1,25 @@ + + + + + + +

{await push(count)}

+ + {#if count !== eager} +

updating

+ {/if} + + {#snippet pending()}{/snippet} +