mirror of https://github.com/sveltejs/svelte
Merge pull request #1773 from sveltejs/elseif-no-else
Handle elseif blocks with no elsepull/1775/head
commit
d06088c333
@ -0,0 +1,21 @@
|
||||
export default {
|
||||
data: {
|
||||
x: 11
|
||||
},
|
||||
|
||||
html: `
|
||||
<p>x is greater than 10</p>
|
||||
`,
|
||||
|
||||
test(assert, component, target) {
|
||||
component.set({ x: 4 });
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<p>x is less than 5</p>
|
||||
`);
|
||||
|
||||
component.set({ x: 6 });
|
||||
assert.htmlEqual(target.innerHTML, ``);
|
||||
|
||||
component.destroy();
|
||||
}
|
||||
};
|
@ -0,0 +1,5 @@
|
||||
{#if x > 10}
|
||||
<p>x is greater than 10</p>
|
||||
{:elseif x < 5}
|
||||
<p>x is less than 5</p>
|
||||
{/if}
|
Loading…
Reference in new issue