File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export class Expression {
2424 }
2525 operands . push ( result )
2626 } else {
27- operands . push ( yield evalToken ( token , ctx , lenient && this . postfix . length === 1 ) )
27+ operands . push ( yield evalToken ( token , ctx , lenient ) )
2828 }
2929 }
3030 return operands [ 0 ]
Original file line number Diff line number Diff line change @@ -55,10 +55,15 @@ describe('LiquidOptions#strict*', function () {
5555 const html = await engine . render ( tpl , ctx )
5656 return expect ( html ) . toBe ( 'beforeXafter' )
5757 } )
58- it ( 'should still throw with an undefined variable in a compound `if` expression' , function ( ) {
59- const tpl = engine . parse ( '{% if notdefined == 15 %}a{% endif %}' )
60- const fhtml = engine . render ( tpl , ctx )
61- return expect ( fhtml ) . rejects . toThrow ( / u n d e f i n e d v a r i a b l e : n o t d e f i n e d / )
58+ it ( 'should not throw with an undefined variable in a compound `if` expression' , async function ( ) {
59+ const tpl = engine . parse ( 'before{% if notdefined == 15 %}X{% else %}Y{% endif %}after' )
60+ const html = await engine . render ( tpl , ctx )
61+ return expect ( html ) . toBe ( 'beforeYafter' )
62+ } )
63+ it ( 'should correctly evaluate undefined variable in a compound `if` expression' , async function ( ) {
64+ const tpl = engine . parse ( 'before{% if notdefined != "value" %}X{% else %}Y{% endif %}after' )
65+ const html = await engine . render ( tpl , ctx )
66+ return expect ( html ) . toBe ( 'beforeXafter' )
6267 } )
6368 it ( 'should allow an undefined variable when before the `default` filter' , async function ( ) {
6469 const tpl = engine . parse ( '{{notdefined | default: "a" | tolower}}' )
You can’t perform that action at this time.
0 commit comments