mirror of https://github.com/sveltejs/svelte
each binding with store props (#5289)
parent
c752ed3527
commit
8148a7a334
@ -0,0 +1,14 @@
|
|||||||
|
export default {
|
||||||
|
async test({ assert, target, window }) {
|
||||||
|
const input = target.querySelector('input');
|
||||||
|
|
||||||
|
const event = new window.Event('input');
|
||||||
|
input.value = 'changed';
|
||||||
|
await input.dispatchEvent(event);
|
||||||
|
|
||||||
|
assert.htmlEqual(target.innerHTML, `
|
||||||
|
<input>
|
||||||
|
<p>changed</p>
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,11 @@
|
|||||||
|
<script>
|
||||||
|
import { writable } from 'svelte/store';
|
||||||
|
|
||||||
|
let itemStore = writable({prop: {things: [{name: "item store"}]}});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#each $itemStore.prop.things as thing }
|
||||||
|
<input bind:value={thing.name} >
|
||||||
|
{/each}
|
||||||
|
|
||||||
|
<p>{$itemStore.prop.things[0].name}</p>
|
Loading…
Reference in new issue