mirror of https://github.com/sveltejs/svelte
Merge pull request #704 from sveltejs/gh-700
use anchor comments to preserve order in keyed each blocks with componentspull/716/head
commit
6a9e1d5db9
@ -0,0 +1 @@
|
||||
<p>{{title}}</p>
|
@ -0,0 +1,24 @@
|
||||
export default {
|
||||
data: {
|
||||
titles: [{ name: 'b' }, { name: 'c' }]
|
||||
},
|
||||
|
||||
html: `
|
||||
<p>b</p>
|
||||
<p>c</p>
|
||||
`,
|
||||
|
||||
test (assert, component, target) {
|
||||
component.set({
|
||||
titles: [{ name: 'a' }, { name: 'b' }, { name: 'c' }]
|
||||
});
|
||||
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<p>a</p>
|
||||
<p>b</p>
|
||||
<p>c</p>
|
||||
`);
|
||||
|
||||
component.destroy();
|
||||
}
|
||||
};
|
@ -0,0 +1,13 @@
|
||||
{{#each titles as title @name}}
|
||||
<Nested title="{{title.name}}"/>
|
||||
{{/each}}
|
||||
|
||||
<script>
|
||||
import Nested from './Nested.html';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Nested
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in new issue