From b2bf4295cb0357efd4a278956b732d1f89a64814 Mon Sep 17 00:00:00 2001 From: paoloricciuti Date: Thu, 9 Jan 2025 17:17:07 +0100 Subject: [PATCH] chore: add test --- .../Component.svelte | 7 +++++++ .../read-version-previous-reaction/_config.js | 19 +++++++++++++++++++ .../main.svelte | 18 ++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 packages/svelte/tests/runtime-runes/samples/read-version-previous-reaction/Component.svelte create mode 100644 packages/svelte/tests/runtime-runes/samples/read-version-previous-reaction/_config.js create mode 100644 packages/svelte/tests/runtime-runes/samples/read-version-previous-reaction/main.svelte diff --git a/packages/svelte/tests/runtime-runes/samples/read-version-previous-reaction/Component.svelte b/packages/svelte/tests/runtime-runes/samples/read-version-previous-reaction/Component.svelte new file mode 100644 index 000000000000..afb62ced2f4b --- /dev/null +++ b/packages/svelte/tests/runtime-runes/samples/read-version-previous-reaction/Component.svelte @@ -0,0 +1,7 @@ + + +

{label}

diff --git a/packages/svelte/tests/runtime-runes/samples/read-version-previous-reaction/_config.js b/packages/svelte/tests/runtime-runes/samples/read-version-previous-reaction/_config.js new file mode 100644 index 000000000000..650e48e84ccd --- /dev/null +++ b/packages/svelte/tests/runtime-runes/samples/read-version-previous-reaction/_config.js @@ -0,0 +1,19 @@ +import { ok, test } from '../../test'; +import { flushSync } from 'svelte'; + +export default test({ + html: `

0

`, + + async test({ assert, target }) { + const p = target.querySelector('p'); + const btn = target.querySelector('button'); + flushSync(() => { + btn?.click(); + }); + assert.equal(p?.innerHTML, '1'); + flushSync(() => { + btn?.click(); + }); + assert.equal(p?.innerHTML, '2'); + } +}); diff --git a/packages/svelte/tests/runtime-runes/samples/read-version-previous-reaction/main.svelte b/packages/svelte/tests/runtime-runes/samples/read-version-previous-reaction/main.svelte new file mode 100644 index 000000000000..773aabeea30b --- /dev/null +++ b/packages/svelte/tests/runtime-runes/samples/read-version-previous-reaction/main.svelte @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file