mirror of https://github.com/sveltejs/svelte
fix binding when updating through accessors (#6523)
parent
c8cdc73464
commit
f906180435
@ -0,0 +1,5 @@
|
||||
<script>
|
||||
export let value;
|
||||
</script>
|
||||
|
||||
<input bind:value />
|
@ -0,0 +1,18 @@
|
||||
export default {
|
||||
async test({ assert, component, target, window }) {
|
||||
const [input1, input2] = target.querySelectorAll('input');
|
||||
assert.equal(input1.value, 'something');
|
||||
assert.equal(input2.value, 'something');
|
||||
|
||||
input1.value = 'abc';
|
||||
|
||||
await input1.dispatchEvent(new window.Event('input'));
|
||||
assert.equal(input1.value, 'abc');
|
||||
assert.equal(input2.value, 'abc');
|
||||
|
||||
await target.querySelector('button').dispatchEvent(new window.MouseEvent('click'));
|
||||
|
||||
assert.equal(input1.value, 'Reset');
|
||||
assert.equal(input2.value, 'Reset');
|
||||
}
|
||||
};
|
@ -0,0 +1,12 @@
|
||||
<script>
|
||||
import Nested from './Nested.svelte';
|
||||
let value = 'something'
|
||||
let c;
|
||||
</script>
|
||||
|
||||
<Nested bind:this={c} bind:value />
|
||||
<input bind:value />
|
||||
|
||||
<button on:click={() => {
|
||||
c.value = 'Reset';
|
||||
}}>Reset</button>
|
Loading…
Reference in new issue