diff options
-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() { |