diff options
author | Ryan Eastridge <ryan@eastridge.xxx> | 2012-12-12 18:10:18 -0800 |
---|---|---|
committer | Ryan Eastridge <ryan@eastridge.xxx> | 2012-12-12 18:10:18 -0800 |
commit | 7ce13a3c2c0dce9a00a5b569f41fa6361d281312 (patch) | |
tree | 198cb59ba4d7a5c478f5807e0d83379489ae6cda /spec/qunit_spec.js | |
parent | 19bfbe07f8d4fd6f66dea29c806024304ce367af (diff) | |
download | handlebars.js-7ce13a3c2c0dce9a00a5b569f41fa6361d281312.zip handlebars.js-7ce13a3c2c0dce9a00a5b569f41fa6361d281312.tar.gz handlebars.js-7ce13a3c2c0dce9a00a5b569f41fa6361d281312.tar.bz2 |
Add failing unit test for private variables
Diffstat (limited to 'spec/qunit_spec.js')
-rw-r--r-- | spec/qunit_spec.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/qunit_spec.js b/spec/qunit_spec.js index 5c94253..cbd34c7 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" }; |