Skip to content

Commit 264517d

Browse files
committed
Add test for local state precedence in inline Svelte components
1 parent fbd4baf commit 264517d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/plugin.svelte.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,21 @@ describe("Inline Svelte Components with sv", () => {
211211
</div>
212212
`);
213213
});
214+
215+
it("allows local state take precendence", () => {
216+
const Counter = html`
217+
<script>
218+
let count = $state(100);
219+
</script>
220+
<p>Count: {count}</p>
221+
`;
222+
223+
const renderer = render(Counter);
224+
225+
expect(renderer.container.firstElementChild).toMatchInlineSnapshot(`
226+
<p>
227+
Count: 100
228+
</p>
229+
`);
230+
});
214231
});

0 commit comments

Comments
 (0)