summaryrefslogtreecommitdiffstats
path: root/spec/qunit_spec.js
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2012-12-23 20:21:36 -0800
committerYehuda Katz <wycats@gmail.com>2012-12-23 20:21:36 -0800
commit070e12f76f251fc038956f61f132dec99a898cd2 (patch)
tree4f95c5221bd186781f9f359ec05f6f81ed33e0b5 /spec/qunit_spec.js
parent9385666e08ed86ddb10095ccfef9fa731adae16e (diff)
parent12f160fb313852f88d7745973124b830ad5f0422 (diff)
downloadhandlebars.js-070e12f76f251fc038956f61f132dec99a898cd2.zip
handlebars.js-070e12f76f251fc038956f61f132dec99a898cd2.tar.gz
handlebars.js-070e12f76f251fc038956f61f132dec99a898cd2.tar.bz2
Merge pull request #390 from eastridge/master
Make {data: true} a default compile option
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 07dde10..dcb7150 100644
--- a/spec/qunit_spec.js
+++ b/spec/qunit_spec.js
@@ -730,6 +730,23 @@ test("each with @index", function() {
equal(result, "0. goodbye! 1. Goodbye! 2. GOODBYE! cruel world!", "The @index variable is used");
});
+test("data passed to helpers", function() {
+ var string = "{{#each letters}}{{this}}{{detectDataInsideEach}}{{/each}}";
+ var hash = {letters: ['a', 'b', 'c']};
+
+ var template = CompilerContext.compile(string);
+ var result = template(hash, {
+ data: {
+ exclaim: '!'
+ }
+ });
+ equal(result, 'a!b!c!');
+});
+
+Handlebars.registerHelper('detectDataInsideEach', function(options) {
+ return options.data && options.data.exclaim;
+});
+
test("log", function() {
var string = "{{log blah}}";
var hash = { blah: "whee" };