mirror of https://github.com/sveltejs/svelte
fix two-way binding for components inside each-blocks - closes #356
parent
df70e7b059
commit
92925ede0d
@ -0,0 +1 @@
|
|||||||
|
<span>{{value.id}}</span>
|
@ -0,0 +1,24 @@
|
|||||||
|
export default {
|
||||||
|
data: {
|
||||||
|
a: [{ id: 'foo' }, { id: 'bar' }, { id: 'baz' }]
|
||||||
|
},
|
||||||
|
|
||||||
|
html: `
|
||||||
|
<span>foo</span><span>bar</span><span>baz</span>
|
||||||
|
`,
|
||||||
|
|
||||||
|
test ( assert, component, target ) {
|
||||||
|
component.set({
|
||||||
|
a: [
|
||||||
|
{ id: 'yep' },
|
||||||
|
{ id: 'nope' }
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.htmlEqual( target.innerHTML, `
|
||||||
|
<span>yep</span><span>nope</span>
|
||||||
|
` );
|
||||||
|
|
||||||
|
component.destroy();
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,13 @@
|
|||||||
|
{{#each a as x}}
|
||||||
|
<Widget bind:value='x'/>
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Widget from './Widget.html';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
Widget
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
Loading…
Reference in new issue