mirror of https://github.com/sveltejs/svelte
fix binding shadow the array in each block (#1565)
parent
36ca311500
commit
982a1937db
@ -0,0 +1,13 @@
|
||||
export default {
|
||||
async test({ assert, component, target }) {
|
||||
assert.equal(target.querySelectorAll('input').length, 3);
|
||||
|
||||
const input = target.querySelector('input');
|
||||
input.value = 'svelte';
|
||||
await input.dispatchEvent(new window.Event('input'));
|
||||
|
||||
assert.equal(target.querySelectorAll('input').length, 3);
|
||||
assert.deepEqual(component.data, { a: 'svelte', b: 'B', c: 'C' });
|
||||
assert.deepEqual(component.x, ['a', 'b', 'c']);
|
||||
},
|
||||
};
|
@ -0,0 +1,15 @@
|
||||
<script>
|
||||
export let x = ['a', 'b', 'c'];
|
||||
export let data = {
|
||||
'a': 'A',
|
||||
'b': 'B',
|
||||
'c': 'C',
|
||||
};
|
||||
export function getData() {
|
||||
return data;
|
||||
}
|
||||
</script>
|
||||
|
||||
{#each x as x}
|
||||
<input type=text bind:value={data[x]}>
|
||||
{/each}
|
Loading…
Reference in new issue