mirror of https://github.com/sveltejs/svelte
Merge pull request #357 from sveltejs/gh-356
fix two-way binding for components inside each-blockspull/360/head
commit
be8efcc9f2
@ -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