mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
fix dependency: strftime
This commit is contained in:
+26
-15
@@ -1,18 +1,20 @@
|
||||
const chai = require("chai");
|
||||
const expect = chai.expect;
|
||||
|
||||
var liquid = require('..')();
|
||||
|
||||
var ctx = {
|
||||
one: 1,
|
||||
two: 2,
|
||||
leq: '<=',
|
||||
empty: '',
|
||||
foo: 'bar',
|
||||
arr: [-2, 'a']
|
||||
};
|
||||
var liquid = require('..')(),
|
||||
ctx;
|
||||
|
||||
describe('tags', function() {
|
||||
beforeEach(function() {
|
||||
ctx = {
|
||||
one: 1,
|
||||
two: 2,
|
||||
leq: '<=',
|
||||
empty: '',
|
||||
foo: 'bar',
|
||||
arr: [-2, 'a']
|
||||
};
|
||||
});
|
||||
it('should support assign', function() {
|
||||
expect(liquid.render('{% assign foo="bar"%}{{foo}}', ctx)).to.equal('bar');
|
||||
});
|
||||
@@ -34,22 +36,31 @@ describe('tags', function() {
|
||||
'{%endcase%}')).to.equal('d');
|
||||
});
|
||||
|
||||
it('should support if', function(){
|
||||
it('should support if', function() {
|
||||
expect(liquid.render('{% if 2==3 %}yes{%else%}no{%endif%}', ctx)).to.equal('no');
|
||||
expect(liquid.render('{% if 1==2 and one<two %}a{%endif%}', ctx)).to.equal('');
|
||||
expect(liquid.render('{% if false %}yes{%else%}no{%endif%}', ctx)).to.equal('no');
|
||||
});
|
||||
|
||||
it('should support unless', function(){
|
||||
it('should support unless', function() {
|
||||
expect(liquid.render('{% unless 1 %}yes{%else%}no{%endunless%}', ctx)).to.equal('no');
|
||||
expect(liquid.render('{% unless 1>2 %}yes{%endunless%}', ctx)).to.equal('yes');
|
||||
});
|
||||
|
||||
it('should support capture', function(){
|
||||
it('should support capture', function() {
|
||||
expect(liquid.render('{% capture f %}{{"a" | capitalize}}{%endcapture%}{{f}}', ctx)).to.equal('A');
|
||||
expect(function(){
|
||||
expect(function() {
|
||||
liquid.render('{% capture = %}{%endcapture%}', ctx);
|
||||
}).to.throw(/= not valid identifier/);
|
||||
});
|
||||
});
|
||||
|
||||
it('should support increment', function() {
|
||||
expect(liquid.render('{% increment foo %}{%increment foo%}{{foo}}', ctx)).to.equal('2');
|
||||
expect(liquid.render('{% increment one %}{{one}}', ctx)).to.equal('2');
|
||||
});
|
||||
|
||||
it('should support decrement', function() {
|
||||
expect(liquid.render('{% decrement foo %}{%decrement foo%}{{foo}}', ctx)).to.equal('-2');
|
||||
expect(liquid.render('{% decrement one %}{{one}}', ctx)).to.equal('0');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user