diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/ast.js | 11 | ||||
-rw-r--r-- | spec/blocks.js | 7 |
2 files changed, 18 insertions, 0 deletions
diff --git a/spec/ast.js b/spec/ast.js index ce4c090..627554c 100644 --- a/spec/ast.js +++ b/spec/ast.js @@ -100,6 +100,10 @@ describe('ast', function() { }); describe('PartialStatement', function() { + it('provides default params', function() { + var pn = new handlebarsEnv.AST.PartialStatement('so_partial', undefined, {}, {}, LOCATION_INFO); + equals(pn.params.length, 0); + }); it('stores location info', function() { var pn = new handlebarsEnv.AST.PartialStatement('so_partial', [], {}, {}, LOCATION_INFO); testLocationInfoStorage(pn); @@ -113,6 +117,13 @@ describe('ast', function() { }); }); + describe('SubExpression', function() { + it('provides default params', function() { + var pn = new handlebarsEnv.AST.SubExpression('path', undefined, {}, LOCATION_INFO); + equals(pn.params.length, 0); + }); + }); + describe('Line Numbers', function() { var ast, body; diff --git a/spec/blocks.js b/spec/blocks.js index 80f1580..3584ed7 100644 --- a/spec/blocks.js +++ b/spec/blocks.js @@ -65,6 +65,13 @@ describe('blocks', function() { shouldCompileTo(string, hash, 'Goodbye cruel sad OMG!'); }); + it('works with cached blocks', function() { + var template = CompilerContext.compile('{{#each person}}{{#with .}}{{first}} {{last}}{{/with}}{{/each}}', {data: false}); + + var result = template({person: [{first: 'Alan', last: 'Johnson'}, {first: 'Alan', last: 'Johnson'}]}); + equals(result, 'Alan JohnsonAlan Johnson'); + }); + describe('inverted sections', function() { it('inverted sections with unset value', function() { var string = '{{#goodbyes}}{{this}}{{/goodbyes}}{{^goodbyes}}Right On!{{/goodbyes}}'; |