mirror of https://github.com/sveltejs/svelte
parent
fe80374bd3
commit
c4b1b548cc
@ -0,0 +1,15 @@
|
||||
import * as assert from 'assert';
|
||||
|
||||
export default {
|
||||
description: '{{#each}}...{{/each}} block',
|
||||
data: {
|
||||
animals: [ 'alpaca', 'baboon', 'capybara' ]
|
||||
},
|
||||
html: '<p>alpaca</p><p>baboon</p><p>capybara</p><!--#each animals-->',
|
||||
test ( component, target ) {
|
||||
component.set({ animals: [ 'alpaca', 'baboon', 'caribou', 'dogfish' ] });
|
||||
assert.equal( target.innerHTML, '<p>alpaca</p><p>baboon</p><p>caribou</p><p>dogfish</p><!--#each animals-->' );
|
||||
component.set({ animals: [] });
|
||||
assert.equal( target.innerHTML, '<!--#each animals-->' );
|
||||
}
|
||||
};
|
@ -0,0 +1,3 @@
|
||||
{{#each animals as animal}}
|
||||
<p>{{animal}}</p>
|
||||
{{/each}}
|
Loading…
Reference in new issue