@@ -3,6 +3,13 @@ describe('UNIT: TextNode Parser', function () {
33 var TextParser = require ( 'vue/src/text-parser' )
44
55 describe ( '.parse()' , function ( ) {
6+
7+ var tokens , badTokens
8+
9+ before ( function ( ) {
10+ tokens = TextParser . parse ( 'hello {{a}}! {{ bcd }}{{d.e.f}} {{a + (b || c) ? d : e}} {{>test}}{{{ a + "<em>" }}}' )
11+ badTokens = TextParser . parse ( '{{{a}}{{{{{{{{b}}}}' )
12+ } )
613
714 it ( 'should return null if no interpolate tags are present' , function ( ) {
815 var result = TextParser . parse ( 'hello no tags' )
@@ -14,11 +21,9 @@ describe('UNIT: TextNode Parser', function () {
1421 assert . strictEqual ( result . length , 3 )
1522 assert . strictEqual ( result [ 2 ] , ' {{hello}}' )
1623 } )
17-
18- var tokens = TextParser . parse ( 'hello {{a}}! {{ bcd }}{{d.e.f}} {{a + (b || c) ? d : e}} {{>test}}' )
1924
2025 it ( 'should extract correct amount of tokens' , function ( ) {
21- assert . strictEqual ( tokens . length , 9 )
26+ assert . strictEqual ( tokens . length , 10 )
2227 } )
2328
2429 it ( 'should extract plain strings' , function ( ) {
@@ -48,6 +53,21 @@ describe('UNIT: TextNode Parser', function () {
4853 assert . strictEqual ( tokens [ 8 ] . key , '>test' )
4954 } )
5055
56+ it ( 'should extract triple mustache (html instead of text)' , function ( ) {
57+ assert . strictEqual ( tokens [ 9 ] . key , 'a + "<em>"' )
58+ assert . ok ( tokens [ 9 ] . html )
59+ } )
60+
61+ it ( 'should deal with bad binding tags' , function ( ) {
62+ assert . strictEqual ( badTokens . length , 4 )
63+ assert . strictEqual ( badTokens [ 0 ] . key , 'a' )
64+ assert . notOk ( badTokens [ 0 ] . html )
65+ assert . strictEqual ( badTokens [ 1 ] , '{{{{{' )
66+ assert . strictEqual ( badTokens [ 2 ] . key , 'b' )
67+ assert . ok ( badTokens [ 2 ] . html )
68+ assert . strictEqual ( badTokens [ 3 ] , '}' )
69+ } )
70+
5171 } )
5272
5373 describe ( '.parseAttr()' , function ( ) {
0 commit comments