You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/runtime/samples/each-block-dynamic-else-static/_config.js

33 lines
615 B

export default {
props: {
animals: [ 'alpaca', 'baboon', 'capybara' ]
},
html: `
<p>alpaca</p>
<p>baboon</p>
<p>capybara</p>
`,
test({ assert, component, target }) {
component.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.animals = [];
component.animals = ['wombat'];
assert.htmlEqual( target.innerHTML, `
<p>wombat</p>
` );
component.animals = ['dinosaur'];
assert.htmlEqual( target.innerHTML, `
<p>dinosaur</p>
` );
}
};