diff options
author | Martin Muñoz <im.mmun@gmail.com> | 2014-11-11 21:35:10 -0500 |
---|---|---|
committer | Martin Muñoz <im.mmun@gmail.com> | 2014-11-11 21:35:10 -0500 |
commit | b8a9f7264d3b6ac48514272bf35291736cedad00 (patch) | |
tree | 08fdbc4c7e73e63f98a136285cc7a9958bec719f /spec/parser.js | |
parent | b3b5b358895566c04b3a9776ac81c5bcf245e27c (diff) | |
download | handlebars.js-b8a9f7264d3b6ac48514272bf35291736cedad00.zip handlebars.js-b8a9f7264d3b6ac48514272bf35291736cedad00.tar.gz handlebars.js-b8a9f7264d3b6ac48514272bf35291736cedad00.tar.bz2 |
Add parser support for block params
Diffstat (limited to 'spec/parser.js')
-rw-r--r-- | spec/parser.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/parser.js b/spec/parser.js index f587365..0569229 100644 --- a/spec/parser.js +++ b/spec/parser.js @@ -157,6 +157,14 @@ describe('parser', function() { }, Error); }); + it('parses block with block params', function() { + equals(ast_for("{{#foo as |bar baz|}}content{{/foo}}"), "BLOCK:\n ID:foo []\n PROGRAM:\n BLOCK PARAMS: [ bar baz ]\n CONTENT[ 'content' ]\n"); + }); + + it('parses inverse block with block params', function() { + equals(ast_for("{{^foo as |bar baz|}}content{{/foo}}"), "BLOCK:\n ID:foo []\n {{^}}\n BLOCK PARAMS: [ bar baz ]\n CONTENT[ 'content' ]\n"); + }); + it("raises if there's a Parse error", function() { shouldThrow(function() { ast_for("foo{{^}}bar"); @@ -193,7 +201,7 @@ describe('parser', function() { describe('externally compiled AST', function() { it('can pass through an already-compiled AST', function() { - equals(ast_for(new Handlebars.AST.ProgramNode([ new Handlebars.AST.ContentNode("Hello")])), "CONTENT[ \'Hello\' ]\n"); + equals(ast_for(new Handlebars.AST.ProgramNode([new Handlebars.AST.ContentNode("Hello")], null)), "CONTENT[ \'Hello\' ]\n"); }); }); }); |