diff --git a/spec/ast.js b/spec/ast.js index b77be6037..09034739f 100644 --- a/spec/ast.js +++ b/spec/ast.js @@ -123,6 +123,40 @@ describe('ast', function() { }); }); + describe('whitespace control', function() { + describe('parse', function() { + it('mustache', function() { + let ast = Handlebars.parse(' {{~comment~}} '); + + equals(ast.body[0].value, ''); + equals(ast.body[2].value, ''); + }); + + it('block statements', function() { + var ast = Handlebars.parse(' {{# comment~}} \nfoo\n {{~/comment}}'); + + equals(ast.body[0].value, ''); + equals(ast.body[1].program.body[0].value, 'foo'); + }); + }); + + describe('parseWithoutProcessing', function() { + it('mustache', function() { + let ast = Handlebars.parseWithoutProcessing(' {{~comment~}} '); + + equals(ast.body[0].value, ' '); + equals(ast.body[2].value, ' '); + }); + + it('block statements', function() { + var ast = Handlebars.parseWithoutProcessing(' {{# comment~}} \nfoo\n {{~/comment}}'); + + equals(ast.body[0].value, ' '); + equals(ast.body[1].program.body[0].value, ' \nfoo\n '); + }); + }); + }); + describe('standalone flags', function() { describe('mustache', function() { it('does not mark mustaches as standalone', function() {