mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
liquid instance
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@ const expect = chai.expect;
|
||||
|
||||
chai.use(sinonChai);
|
||||
|
||||
var filter = require('../filter.js');
|
||||
var filter = require('../filter.js')();
|
||||
var context = require('../context.js');
|
||||
|
||||
describe('filter', function() {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
const chai = require("chai");
|
||||
const expect = chai.expect;
|
||||
|
||||
var liquid = require('..')();
|
||||
|
||||
describe('filters', function() {
|
||||
var ctx = {
|
||||
foo: 'bar',
|
||||
arr: [-2, 'a']
|
||||
};
|
||||
|
||||
it('should support abs', function() {
|
||||
expect(liquid.render('{{ -3 | abs }}', ctx)).to.equal('3');
|
||||
expect(liquid.render('{{ arr[0] | abs }}', ctx)).to.equal('2');
|
||||
});
|
||||
});
|
||||
+2
-2
@@ -14,7 +14,7 @@ describe('identifier', function() {
|
||||
it('should test number literal', function() {
|
||||
identifier.isLiteral('2.3').should.equal(true);
|
||||
identifier.isLiteral('.3').should.equal(true);
|
||||
identifier.isLiteral('3.').should.equal(true);
|
||||
identifier.isLiteral('-3.').should.equal(true);
|
||||
identifier.isLiteral('23').should.equal(true);
|
||||
});
|
||||
|
||||
@@ -58,7 +58,7 @@ describe('identifier', function() {
|
||||
it('should parse number literal', function() {
|
||||
identifier.parseLiteral('2.3').should.equal(2.3);
|
||||
identifier.parseLiteral('.32').should.equal(0.32);
|
||||
identifier.parseLiteral('23.').should.equal(23);
|
||||
identifier.parseLiteral('-23.').should.equal(-23);
|
||||
identifier.parseLiteral('23').should.equal(23);
|
||||
});
|
||||
|
||||
|
||||
+3
-3
@@ -5,10 +5,10 @@ const expect = chai.expect;
|
||||
|
||||
chai.use(sinonChai);
|
||||
|
||||
var tag = require('../tag.js');
|
||||
var tag = require('../tag.js')();
|
||||
var context = require('../context.js');
|
||||
var filter = require('../filter');
|
||||
var render = require('../render.js');
|
||||
var filter = require('../filter')();
|
||||
var render = require('../render.js')(filter, tag);
|
||||
|
||||
describe('render', function() {
|
||||
var ctx, htmlToken, tagToken, filterToken;
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ var sinon = require("sinon");
|
||||
var expect = chai.expect;
|
||||
chai.use(sinonChai);
|
||||
|
||||
var tag = require('../tag.js');
|
||||
var tag = require('../tag.js')();
|
||||
var context = require('../context.js');
|
||||
|
||||
describe('tag', function() {
|
||||
|
||||
Reference in New Issue
Block a user