mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
Comparison on NULL is always false (#27)
* All values in Liquid are truthy except nil and false. * The falsy values are null, undefined and false. * comparison on null
This commit is contained in:
@@ -52,4 +52,53 @@ describe('tags/if', function() {
|
||||
return expect(liquid.parseAndRender(src, ctx))
|
||||
.to.eventually.equal('a');
|
||||
});
|
||||
|
||||
it('should return else when comparison on null 1', function() {
|
||||
var src = "{% if null < 10 %}yes{% else %}no{% endif %}";
|
||||
return expect(liquid.parseAndRender(src, ctx))
|
||||
.to.eventually.equal('no');
|
||||
});
|
||||
|
||||
it('should return else when comparison on null 2', function() {
|
||||
var src = "{% if null <= 10 %}yes{% else %}no{% endif %}";
|
||||
return expect(liquid.parseAndRender(src, ctx))
|
||||
.to.eventually.equal('no');
|
||||
});
|
||||
|
||||
it('should return else when comparison on null 3', function() {
|
||||
var src = "{% if null >= 10 %}yes{% else %}no{% endif %}";
|
||||
return expect(liquid.parseAndRender(src, ctx))
|
||||
.to.eventually.equal('no');
|
||||
});
|
||||
|
||||
it('should return else when comparison on null 4', function() {
|
||||
var src = "{% if null > 10 %}yes{% else %}no{% endif %}";
|
||||
return expect(liquid.parseAndRender(src, ctx))
|
||||
.to.eventually.equal('no');
|
||||
});
|
||||
|
||||
it('should return else when comparison on null 5', function() {
|
||||
var src = "{% if 10 < null %}yes{% else %}no{% endif %}";
|
||||
return expect(liquid.parseAndRender(src, ctx))
|
||||
.to.eventually.equal('no');
|
||||
});
|
||||
|
||||
it('should return else when comparison on null 6', function() {
|
||||
var src = "{% if 10 <= null %}yes{% else %}no{% endif %}";
|
||||
return expect(liquid.parseAndRender(src, ctx))
|
||||
.to.eventually.equal('no');
|
||||
});
|
||||
|
||||
it('should return else when comparison on null 7', function() {
|
||||
var src = "{% if 10 >= null %}yes{% else %}no{% endif %}";
|
||||
return expect(liquid.parseAndRender(src, ctx))
|
||||
.to.eventually.equal('no');
|
||||
});
|
||||
|
||||
it('should return else when comparison on null 8', function() {
|
||||
var src = "{% if 10 > null %}yes{% else %}no{% endif %}";
|
||||
return expect(liquid.parseAndRender(src, ctx))
|
||||
.to.eventually.equal('no');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user