-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ensure we visit assignments during compilation (#9511)
* fix: add missing visit for expressions * fix: add missing visit for expressions * Add test
- Loading branch information
Showing
5 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'svelte': patch | ||
--- | ||
|
||
fix: add missing visitor for assignments during compilation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/svelte/tests/runtime-runes/samples/bind-state-property/CheckBox.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<script> | ||
let { checked, ...rest } = $props(); | ||
</script> | ||
|
||
<input type="checkbox" bind:checked {...rest} /> |
12 changes: 12 additions & 0 deletions
12
packages/svelte/tests/runtime-runes/samples/bind-state-property/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
html: `<input type="checkbox"><br>\nChecked:\nfalse`, | ||
|
||
async test({ assert, target }) { | ||
const input = target.querySelector('input'); | ||
|
||
await input?.click(); | ||
assert.htmlEqual(target.innerHTML, `<input type="checkbox"><br>\nChecked:\ntrue`); | ||
} | ||
}); |
18 changes: 18 additions & 0 deletions
18
packages/svelte/tests/runtime-runes/samples/bind-state-property/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<script> | ||
import CheckBox from './CheckBox.svelte'; | ||
let checked = $state(false); | ||
function wrap() { | ||
return { | ||
get checked() { return checked }, | ||
set checked(v) { checked = v }, | ||
} | ||
} | ||
</script> | ||
|
||
{#if true} | ||
{@const obj = wrap()} | ||
<CheckBox type="checkbox" bind:checked={obj.checked} /> | ||
{/if} | ||
<br/> | ||
Checked: {checked} |
3780939
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
svelte-5-preview – ./sites/svelte-5-preview
svelte-5-preview-git-main-svelte.vercel.app
svelte-5-preview-svelte.vercel.app
svelte-5-preview.vercel.app
svelte-octane.vercel.app