|
@@ -4,11 +4,10 @@ describe('Text Parser', function () {
|
|
|
|
|
|
|
|
describe('.parse()', function () {
|
|
describe('.parse()', function () {
|
|
|
|
|
|
|
|
- var tokens, badTokens
|
|
|
|
|
|
|
+ var tokens
|
|
|
|
|
|
|
|
before(function () {
|
|
before(function () {
|
|
|
- tokens = TextParser.parse('hello {{a}}! {{ bcd }}{{d.e.f}} {{a + (b || c) ? d : e}} {{>test}}{{{ a + "<em>" }}}')
|
|
|
|
|
- badTokens = TextParser.parse('{{{a}}{{{{{{{{b}}}}')
|
|
|
|
|
|
|
+ tokens = TextParser.parse('hello {{a}}! {{ {bcd} }}{{d.e.f}} {{a + (b || c) ? d : e}} {{>test}}{{{ a + "<em>" }}}')
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return null if no interpolate tags are present', function () {
|
|
it('should return null if no interpolate tags are present', function () {
|
|
@@ -38,7 +37,7 @@ describe('Text Parser', function () {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should trim extracted keys', function () {
|
|
it('should trim extracted keys', function () {
|
|
|
- assert.strictEqual(tokens[3].key, 'bcd')
|
|
|
|
|
|
|
+ assert.strictEqual(tokens[3].key, '{bcd}')
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should extract nested keys', function () {
|
|
it('should extract nested keys', function () {
|
|
@@ -58,16 +57,6 @@ describe('Text Parser', function () {
|
|
|
assert.ok(tokens[9].html)
|
|
assert.ok(tokens[9].html)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- it('should deal with bad binding tags', function () {
|
|
|
|
|
- assert.strictEqual(badTokens.length, 4)
|
|
|
|
|
- assert.strictEqual(badTokens[0].key, 'a')
|
|
|
|
|
- assert.notOk(badTokens[0].html)
|
|
|
|
|
- assert.strictEqual(badTokens[1], '{{{{{')
|
|
|
|
|
- assert.strictEqual(badTokens[2].key, 'b')
|
|
|
|
|
- assert.ok(badTokens[2].html)
|
|
|
|
|
- assert.strictEqual(badTokens[3], '}')
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
describe('.parseAttr()', function () {
|
|
describe('.parseAttr()', function () {
|