diff options
Diffstat (limited to 'spec/qunit_spec.js')
-rw-r--r-- | spec/qunit_spec.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/qunit_spec.js b/spec/qunit_spec.js index 62214ec..10b7424 100644 --- a/spec/qunit_spec.js +++ b/spec/qunit_spec.js @@ -207,6 +207,13 @@ test("this keyword in paths", function() { shouldCompileTo(string, hash, "helloHelloHELLO", "This keyword evaluates in more complex paths"); }); +test("this keyword nested inside path", function() { + var string = "{{#hellos}}{{text/this/foo}}{{/hellos}}"; + shouldThrow(function() { + CompilerContext.compile(string); + }, Error, "Should throw exception"); +}); + test("this keyword in helpers", function() { var helpers = {foo: function(value) { return 'bar ' + value; @@ -221,6 +228,13 @@ test("this keyword in helpers", function() { shouldCompileTo(string, [hash, helpers], "bar hellobar Hellobar HELLO", "This keyword evaluates in more complex paths"); }); +test("this keyword nested inside helpers param", function() { + var string = "{{#hellos}}{{foo text/this/foo}}{{/hellos}}"; + shouldThrow(function() { + CompilerContext.compile(string); + }, Error, "Should throw exception"); +}); + suite("inverted sections"); test("inverted sections with unset value", function() { @@ -286,6 +300,14 @@ test("block with complex lookup", function() { "Templates can access variables in contexts up the stack with relative path syntax"); }); +test("block with complex lookup using nested context", function() { + var string = "{{#goodbyes}}{{text}} cruel {{foo/../name}}! {{/goodbyes}}"; + + shouldThrow(function() { + CompilerContext.compile(string); + }, Error, "Should throw exception"); +}); + test("helper with complex lookup$", function() { var string = "{{#goodbyes}}{{{link ../prefix}}}{{/goodbyes}}"; var hash = {prefix: "/root", goodbyes: [{text: "Goodbye", url: "goodbye"}]}; |