feature: support toLiquid, working on #81

This commit is contained in:
harttle
2018-08-14 00:11:50 +08:00
committed by Jun Yang
parent 5b43520d78
commit 7a3689067b
5 changed files with 29 additions and 2 deletions
+11
View File
@@ -34,6 +34,17 @@ describe('util/underscore', function () {
expect(_.isString(123)).to.be.false
})
})
describe('.stringify()', function () {
it('should respect to to_liquid() method', function () {
expect(_.stringify({to_liquid: () => 'foo'})).to.equal('foo')
})
it('should respect to toLiquid() method', function () {
expect(_.stringify({toLiquid: () => 'foo'})).to.equal('foo')
})
it('should recursively call toLiquid()', function () {
expect(_.stringify({toLiquid: () => ({toLiquid: () => 'foo'})})).to.equal('foo')
})
})
describe('.forOwn()', function () {
it('should iterate all properties', function () {
var spy = sinon.spy()