raw and comment

This commit is contained in:
harttle
2016-06-20 01:10:43 +08:00
parent 54bc206d36
commit 8053d7021f
16 changed files with 105 additions and 51 deletions
+10
View File
@@ -1,5 +1,6 @@
var chai = require("chai");
var should = chai.should();
var expect = chai.expect;
var tokenizer = require('../tokenizer.js');
@@ -39,4 +40,13 @@ describe('tokenizer', function() {
tokens[1].value.should.equal('bar');
tokens[2].value.should.equal('foo');
});
it('should keep white spaces and newlines', function(){
var html = '{{foo}}\n{%bar %} \n {{alice}}';
var tokens = tokenizer.parse(html);
expect(tokens.length).to.equal(5);
expect(tokens[1].type).to.equal('html');
expect(tokens[1].raw).to.equal('\n');
expect(tokens[3].type).to.equal('html');
expect(tokens[3].raw).to.equal(' \n ');
});
});