Skip to content

Commit

Permalink
Add explicit tests to spec/ast.js for using whitespace control
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue committed Oct 27, 2019
1 parent 0ef643e commit 1f1e071
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions spec/ast.js
Expand Up @@ -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() {
Expand Down

0 comments on commit 1f1e071

Please sign in to comment.