Add failing test case for each-block-keyed-else / #4536

pull/4552/head
Benjamin W. Broersma 6 years ago
parent a66437b3c1
commit e92902f777

@ -0,0 +1,37 @@
export default {
props: {
animals: ['alpaca', 'baboon', 'capybara'],
foo: 'something else'
},
html: `
before
<p>alpaca</p>
<p>baboon</p>
<p>capybara</p>
after
`,
test({ assert, component, target }) {
component.animals = [];
assert.htmlEqual(target.innerHTML, `
before
<p>no animals, but rather something else</p>
after
`);
component.foo = 'something other';
assert.htmlEqual(target.innerHTML, `
before
<p>no animals, but rather something other</p>
after
`);
component.animals = ['wombat'];
assert.htmlEqual(target.innerHTML, `
before
<p>wombat</p>
after
`);
}
};

@ -0,0 +1,12 @@
<script>
export let animals;
export let foo;
</script>
before
{#each animals as animal (animal)}
<p>{animal}</p>
{:else}
<p>no animals, but rather {foo}</p>
{/each}
after
Loading…
Cancel
Save