mirror of https://github.com/sveltejs/svelte
Merge pull request #663 from sveltejs/gh-662
fix each-else blocks that are empty on initial renderpull/666/head
commit
7b9ea71153
@ -0,0 +1,21 @@
|
||||
export default {
|
||||
data: {
|
||||
animals: [],
|
||||
foo: 'something else'
|
||||
},
|
||||
|
||||
html: `
|
||||
before
|
||||
<p>no animals, but rather something else</p>
|
||||
after
|
||||
`,
|
||||
|
||||
test ( assert, component, target ) {
|
||||
component.set({ animals: ['wombat'] });
|
||||
assert.htmlEqual( target.innerHTML, `
|
||||
before
|
||||
<p>wombat</p>
|
||||
after
|
||||
` );
|
||||
}
|
||||
};
|
@ -0,0 +1,7 @@
|
||||
before
|
||||
{{#each animals as animal}}
|
||||
<p>{{animal}}</p>
|
||||
{{else}}
|
||||
<p>no animals, but rather {{foo}}</p>
|
||||
{{/each}}
|
||||
after
|
Loading…
Reference in new issue