fix: elsif is not supported for unless, fixes #268

This commit is contained in:
harttle
2020-12-08 00:16:36 +08:00
parent a492d8e23d
commit 2bbf50171b
5 changed files with 47 additions and 8 deletions
+12
View File
@@ -42,4 +42,16 @@ describe('Issues', function () {
const html = engine.parseAndRenderSync(template)
expect(html).to.equal('This is a code snippet showing how {% breaks the raw block.')
})
it('#268 elsif is not supported for unless', () => {
const template = `{%- unless condition1 -%}
<div>X</div>
{%- elsif condition2 -%}
<div>Y</div>
{%- else %}
<div>Z</div>
{% endunless %}`
const engine = new Liquid()
const html = engine.parseAndRenderSync(template, { condition1: true, condition2: true })
expect(html).to.equal('<div>Y</div>')
})
})