refactor: es6 building and linting

This commit is contained in:
harttle
2018-08-16 23:14:12 +08:00
parent 5f634b0b5e
commit 19891b2df0
68 changed files with 1636 additions and 1575 deletions
+8 -8
View File
@@ -3,13 +3,13 @@ const expect = chai.expect
chai.use(require('sinon-chai'))
var filter = require('../src/filter.js')()
var tag = require('../src/tag.js')()
var Template = require('../src/parser.js')
let filter = require('../src/filter.js')()
let tag = require('../src/tag.js')()
let Template = require('../src/parser.js')
describe('template', function () {
var template
var add = (l, r) => l + r
let template
let add = (l, r) => l + r
beforeEach(function () {
filter.clear()
@@ -26,21 +26,21 @@ describe('template', function () {
})
it('should parse value string', function () {
var tpl = template.parseValue('foo')
let tpl = template.parseValue('foo')
expect(tpl.type).to.equal('value')
expect(tpl.initial).to.equal('foo')
expect(tpl.filters).to.deep.equal([])
})
it('should parse value string with a simple filter', function () {
var tpl = template.parseValue('foo | add: 3, "foo"')
let tpl = template.parseValue('foo | add: 3, "foo"')
expect(tpl.initial).to.equal('foo')
expect(tpl.filters.length).to.equal(1)
expect(tpl.filters[0].filter).to.equal(add)
})
it('should parse value string with filters', function () {
var tpl = template.parseValue('foo | add: "|" | add')
let tpl = template.parseValue('foo | add: "|" | add')
expect(tpl.initial).to.equal('foo')
expect(tpl.filters.length).to.equal(2)
})