diff options
Diffstat (limited to 'spec/runtime.js')
-rw-r--r-- | spec/runtime.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/runtime.js b/spec/runtime.js index 4431a68..dc6e512 100644 --- a/spec/runtime.js +++ b/spec/runtime.js @@ -33,4 +33,24 @@ describe('runtime', function() { }, Error, /Template was precompiled with an older version of Handlebars than the current runtime/); }); }); + + describe('#child', function() { + if (!Handlebars.compile) { + return; + } + + it('should throw for depthed methods', function() { + shouldThrow(function() { + var template = Handlebars.compile('{{#foo}}{{../bar}}{{/foo}}'); + template._setup({}); + template._setup({}); + template._child(1); + }, Error, '_child can not be used with depthed templates'); + }); + it('should expose child template', function() { + var template = Handlebars.compile('{{#foo}}bar{{/foo}}'); + equal(template._child(1)(), 'bar'); + equal(template._child(1)(), 'bar'); + }); + }); }); |