mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
fix: report error for malformed else/elsif/endif/endfor, #713
This commit is contained in:
+2
-10
@@ -471,19 +471,11 @@ describe('Issues', function () {
|
||||
})
|
||||
it('#670 Should not render anything after an else branch', () => {
|
||||
const engine = new Liquid()
|
||||
const result = engine.parseAndRenderSync('{% assign value = "this" %}' +
|
||||
'{% if false %}don\'t show' +
|
||||
'{% else %}show {{ value }}' +
|
||||
'{% else %}don\'t show{% endif %}', {})
|
||||
expect(result).toEqual('show this')
|
||||
expect(() => engine.parseAndRenderSync('{% assign value = "this" %}{% if false %}{% else %}{% else %}{% endif %}')).toThrow('duplicated else')
|
||||
})
|
||||
it('#672 Should not render an elseif after an else branch', () => {
|
||||
const engine = new Liquid()
|
||||
const result = engine.parseAndRenderSync('{% if false %}don\'t show' +
|
||||
'{% else %}show' +
|
||||
'{% elsif true %}don\'t show' +
|
||||
'{% endif %}', {})
|
||||
expect(result).toEqual('show')
|
||||
expect(() => engine.parseAndRenderSync('{% if false %}{% else %}{% elsif true %}{% endif %}')).toThrow('unexpected elsif after else')
|
||||
})
|
||||
it('#675 10.10.1 Operator: contains regression', () => {
|
||||
const engine = new Liquid()
|
||||
|
||||
Reference in New Issue
Block a user