summaryrefslogtreecommitdiffstats
path: root/spec/qunit_spec.js
diff options
context:
space:
mode:
authorYehuda Katz <tomhuda@Yehudas-iMac.local>2011-12-27 15:57:08 -0800
committerYehuda Katz <tomhuda@Yehudas-iMac.local>2011-12-27 15:57:08 -0800
commite474e56b804d55d294d7bd1ae6c37c4bc57eb1f0 (patch)
tree923644846a198ec60e0973d8bc95bfba939bd0e0 /spec/qunit_spec.js
parent69307d0e2b149228c1422ac30b6b2020b1a75ed9 (diff)
downloadhandlebars.js-e474e56b804d55d294d7bd1ae6c37c4bc57eb1f0.zip
handlebars.js-e474e56b804d55d294d7bd1ae6c37c4bc57eb1f0.tar.gz
handlebars.js-e474e56b804d55d294d7bd1ae6c37c4bc57eb1f0.tar.bz2
data should be passed through to partials. closes #111.
Diffstat (limited to 'spec/qunit_spec.js')
-rw-r--r--spec/qunit_spec.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/qunit_spec.js b/spec/qunit_spec.js
index 3f9218d..6f5a192 100644
--- a/spec/qunit_spec.js
+++ b/spec/qunit_spec.js
@@ -650,6 +650,23 @@ test("passing in data to a compiled function that expects data - works with help
equals("happy cat", result, "Data output by helper");
});
+test("passing in data to a compiled function that expects data - works with helpers in partials", function() {
+ var template = CompilerContext.compile("{{>my_partial}}", {data: true});
+
+ var partials = {
+ my_partial: CompilerContext.compile("{{hello}}", {data: true})
+ };
+
+ var helpers = {
+ hello: function(options) {
+ return options.data.adjective + " " + this.noun;
+ }
+ };
+
+ var result = template({noun: "cat"}, {helpers: helpers, partials: partials, data: {adjective: "happy"}});
+ equals("happy cat", result, "Data output by helper inside partial");
+});
+
test("passing in data to a compiled function that expects data - works with helpers and parameters", function() {
var template = CompilerContext.compile("{{hello world}}", {data: true});