mirror of https://github.com/sveltejs/svelte
33 lines
645 B
33 lines
645 B
export default {
|
|
data: {
|
|
animals: [ 'alpaca', 'baboon', 'capybara' ]
|
|
},
|
|
|
|
html: `
|
|
<p>alpaca</p>
|
|
<p>baboon</p>
|
|
<p>capybara</p>
|
|
`,
|
|
|
|
test ( assert, component, target ) {
|
|
component.set({ animals: [] });
|
|
assert.htmlEqual( target.innerHTML, `
|
|
<p>no animals</p>
|
|
` );
|
|
|
|
// trigger an 'update' of the else block, to ensure that
|
|
// non-existent update method is not called
|
|
component.set({ animals: [] });
|
|
|
|
component.set({ animals: ['wombat'] });
|
|
assert.htmlEqual( target.innerHTML, `
|
|
<p>wombat</p>
|
|
` );
|
|
|
|
component.set({ animals: ['dinosaur'] });
|
|
assert.htmlEqual( target.innerHTML, `
|
|
<p>dinosaur</p>
|
|
` );
|
|
}
|
|
};
|