From deda7d7dc68b15137697057205556ef869bb857c Mon Sep 17 00:00:00 2001 From: raythurnvoid <53383860+raythurnvoid@users.noreply.github.com> Date: Mon, 2 Jun 2025 15:55:50 +0100 Subject: [PATCH] Add tests --- .../_config.js | 34 +++++++++++++++++++ .../main.svelte | 22 ++++++++++++ .../module.svelte.js | 19 +++++++++++ .../nested.svelte | 15 ++++++++ 4 files changed, 90 insertions(+) create mode 100644 packages/svelte/tests/runtime-runes/samples/mount-component-in-onmount-with-context-with-state/_config.js create mode 100644 packages/svelte/tests/runtime-runes/samples/mount-component-in-onmount-with-context-with-state/main.svelte create mode 100644 packages/svelte/tests/runtime-runes/samples/mount-component-in-onmount-with-context-with-state/module.svelte.js create mode 100644 packages/svelte/tests/runtime-runes/samples/mount-component-in-onmount-with-context-with-state/nested.svelte diff --git a/packages/svelte/tests/runtime-runes/samples/mount-component-in-onmount-with-context-with-state/_config.js b/packages/svelte/tests/runtime-runes/samples/mount-component-in-onmount-with-context-with-state/_config.js new file mode 100644 index 0000000000..f3dd65eded --- /dev/null +++ b/packages/svelte/tests/runtime-runes/samples/mount-component-in-onmount-with-context-with-state/_config.js @@ -0,0 +1,34 @@ +import { flushSync } from 'svelte'; +import { test } from '../../test'; + +export default test({ + test({ assert, target, logs }) { + const button = target.querySelector('button'); + + assert.htmlEqual( + target.innerHTML, + ` + +
First if block:
+ First: true +Second if block:
+ Second: true +First if block:
+Second if block:
+First if block:
+{#if stateObjectFromContext.showText === true} + First: {stateObjectFromContext.showText} +{/if} + +Second if block:
+{#if stateObjectFromContext.showText === true} + Second: {stateObjectFromContext.showText} +{/if}