mirror of https://github.com/sveltejs/svelte
fix: correctly ensure prop bindings are reactive when bound (#12879)
* fix: correctly ensure prop bindings are reactive when bound * oops * Apply suggestions from code review * Update packages/svelte/src/compiler/phases/3-transform/client/utils.js --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>pull/12887/head
parent
cb75b5c966
commit
94ed09628d
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: correctly ensure prop bindings are reactive when bound
|
@ -0,0 +1,5 @@
|
||||
<script>
|
||||
export let value;
|
||||
</script>
|
||||
|
||||
<input type="text" bind:value />
|
@ -0,0 +1,22 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { ok, test } from '../../test';
|
||||
|
||||
export default test({
|
||||
accessors: false,
|
||||
html: `<input type="text">\naaa`,
|
||||
ssrHtml: `<input type="text" value="aaa">\naaa`,
|
||||
|
||||
test({ assert, target }) {
|
||||
const input = target.querySelector('input');
|
||||
ok(input);
|
||||
|
||||
const event = new window.Event('input');
|
||||
|
||||
input.value = 'aaa2';
|
||||
input.dispatchEvent(event);
|
||||
|
||||
flushSync();
|
||||
|
||||
assert.htmlEqual(target.innerHTML, `<input type="text">\naaa2`);
|
||||
}
|
||||
});
|
@ -0,0 +1,9 @@
|
||||
<script>
|
||||
import Field from './Field.svelte';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
const value = writable('aaa');
|
||||
|
||||
</script>
|
||||
|
||||
<Field bind:value={$value} /> {$value}
|
Loading…
Reference in new issue