summaryrefslogtreecommitdiffstats
path: root/spec/runtime.js
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2014-08-23 18:52:30 -0500
committerkpdecker <kpdecker@gmail.com>2014-08-23 18:52:30 -0500
commit2b3fdf7ea80bb7af8e6317c2ce30a4ce3236e7f6 (patch)
treeb5147e7095aa4c17ef23f22c50bb95516b9658bc /spec/runtime.js
parent0c7c37df6aa31a3e70f9eecadcaaa25928921c94 (diff)
downloadhandlebars.js-2b3fdf7ea80bb7af8e6317c2ce30a4ce3236e7f6.zip
handlebars.js-2b3fdf7ea80bb7af8e6317c2ce30a4ce3236e7f6.tar.gz
handlebars.js-2b3fdf7ea80bb7af8e6317c2ce30a4ce3236e7f6.tar.bz2
Additional test coverage cleanup
Also fixes the template._child implementation which broke with the depthed work.
Diffstat (limited to 'spec/runtime.js')
-rw-r--r--spec/runtime.js20
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');
+ });
+ });
});