From d50b4d955a8633aceeddad5711f65434e02c3a39 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Mon, 22 Sep 2025 14:58:02 -0400 Subject: [PATCH] add another test --- .../async-boundary-coordination/_config.js | 46 +++++++++++++++++++ .../async-boundary-coordination/main.svelte | 35 ++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 packages/svelte/tests/runtime-runes/samples/async-boundary-coordination/_config.js create mode 100644 packages/svelte/tests/runtime-runes/samples/async-boundary-coordination/main.svelte diff --git a/packages/svelte/tests/runtime-runes/samples/async-boundary-coordination/_config.js b/packages/svelte/tests/runtime-runes/samples/async-boundary-coordination/_config.js new file mode 100644 index 0000000000..f3e60e7b32 --- /dev/null +++ b/packages/svelte/tests/runtime-runes/samples/async-boundary-coordination/_config.js @@ -0,0 +1,46 @@ +import { tick } from 'svelte'; +import { test } from '../../test'; + +export default test({ + async test({ assert, target }) { + await tick(); + + assert.htmlEqual( + target.innerHTML, + ` +

hello from server

+

hello from server

+

hello from server

+

hello from server

+ ` + ); + + const [button1, button2] = target.querySelectorAll('button'); + + button1.click(); + await tick(); + + assert.htmlEqual( + target.innerHTML, + ` +

hello from browser

+

hello from browser

+

hello from server

+

hello from server

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

hello from browser

+

hello from browser

+

hello from browser

+

hello from browser

+ ` + ); + } +}); diff --git a/packages/svelte/tests/runtime-runes/samples/async-boundary-coordination/main.svelte b/packages/svelte/tests/runtime-runes/samples/async-boundary-coordination/main.svelte new file mode 100644 index 0000000000..3986c45046 --- /dev/null +++ b/packages/svelte/tests/runtime-runes/samples/async-boundary-coordination/main.svelte @@ -0,0 +1,35 @@ + + + + + + + + {#if await a.promise} +

hello from {browser ? 'browser' : 'server'}

+ {/if} + +

hello from {browser ? 'browser' : 'server'}

+
+ + + {#if await b.promise} +

hello from {browser ? 'browser' : 'server'}

+ {/if} + +

hello from {browser ? 'browser' : 'server'}

+