mirror of https://github.com/sveltejs/svelte
fix each-else blocks that are empty on initial render (#662)
parent
f6f929bded
commit
dcb905aab6
@ -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