test: cover parseFilters in template/value.ts

This commit is contained in:
harttle
2019-03-06 01:46:35 +08:00
parent 998832c772
commit ad0930f152
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -25,6 +25,12 @@ describe('Value', function () {
expect(tpl.filters.length).to.equal(1)
expect(tpl.filters[0].args).to.eql([])
})
it('should parse "foo,foo | add"', function () {
const tpl = new Value('foo,foo | add', false)
expect(tpl.initial).to.equal('foo')
expect(tpl.filters.length).to.equal(1)
expect(tpl.filters[0].args).to.eql([])
})
it('should parse "foo | add: 3, false"', function () {
const tpl = new Value('foo | add: 3, "foo"', false)
expect(tpl.initial).to.equal('foo')