diff options
author | kpdecker <kpdecker@gmail.com> | 2012-07-30 21:12:03 -0500 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2012-07-30 21:12:03 -0500 |
commit | d8825b1961857834ee0c3cec8b663bc9185f3028 (patch) | |
tree | ff14d0d53274593ef861e5b6c882de0223e831d0 /spec/qunit_spec.js | |
parent | 8be16c64f9e8a8b75cd01de02e53f7a3d9842e07 (diff) | |
download | handlebars.js-d8825b1961857834ee0c3cec8b663bc9185f3028.zip handlebars.js-d8825b1961857834ee0c3cec8b663bc9185f3028.tar.gz handlebars.js-d8825b1961857834ee0c3cec8b663bc9185f3028.tar.bz2 |
this parameter tests
Diffstat (limited to 'spec/qunit_spec.js')
-rw-r--r-- | spec/qunit_spec.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/qunit_spec.js b/spec/qunit_spec.js index aca8fcb..9f2728e 100644 --- a/spec/qunit_spec.js +++ b/spec/qunit_spec.js @@ -163,6 +163,20 @@ test("this keyword in paths", function() { shouldCompileTo(string, hash, "helloHelloHELLO", "This keyword evaluates in more complex paths"); }); +test("this keyword in helpers", function() { + var helpers = {foo: function(value, options) { + return 'bar ' + value; + }}; + var string = "{{#goodbyes}}{{foo this}}{{/goodbyes}}"; + var hash = {goodbyes: ["goodbye", "Goodbye", "GOODBYE"]}; + shouldCompileTo(string, [hash, helpers], "bar goodbyebar Goodbyebar GOODBYE", + "This keyword in paths evaluates to current context"); + + string = "{{#hellos}}{{foo this/text}}{{/hellos}}"; + hash = {hellos: [{text: "hello"}, {text: "Hello"}, {text: "HELLO"}]}; + shouldCompileTo(string, [hash, helpers], "bar hellobar Hellobar HELLO", "This keyword evaluates in more complex paths"); +}); + module("inverted sections"); test("inverted sections with unset value", function() { |