mirror of https://github.com/sveltejs/svelte
fix: ensure we visit assignments during compilation (#9511)
* fix: add missing visit for expressions * fix: add missing visit for expressions * Add testpull/9492/head
parent
4418ba6535
commit
378093941d
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: add missing visitor for assignments during compilation
|
@ -0,0 +1,5 @@
|
||||
<script>
|
||||
let { checked, ...rest } = $props();
|
||||
</script>
|
||||
|
||||
<input type="checkbox" bind:checked {...rest} />
|
@ -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`);
|
||||
}
|
||||
});
|
@ -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}
|
Loading…
Reference in new issue