diff options
Diffstat (limited to 'spec/helpers.js')
-rw-r--r-- | spec/helpers.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/helpers.js b/spec/helpers.js index 904f56a..ccde982 100644 --- a/spec/helpers.js +++ b/spec/helpers.js @@ -9,6 +9,26 @@ describe('helpers', function() { shouldCompileTo(string, [hash, helpers], "<a href='/root/goodbye'>Goodbye</a>"); }); + it("helper for raw block gets raw content", function() { + var string = "{{{{raw}}}} {{test}} {{{{/raw}}}}"; + var hash = { test: "hello" }; + var helpers = { raw: function(options) { + return options.fn(); + } }; + shouldCompileTo(string, [hash, helpers], " {{test}} ", + "raw block helper gets raw content"); + }); + + it("helper for raw block gets parameters", function() { + var string = "{{{{raw 1 2 3}}}} {{test}} {{{{/raw}}}}"; + var hash = { test: "hello" }; + var helpers = { raw: function(a, b, c, options) { + return options.fn() + a + b + c; + } }; + shouldCompileTo(string, [hash, helpers], " {{test}} 123", + "raw block helper gets raw content"); + }); + it("helper block with complex lookup expression", function() { var string = "{{#goodbyes}}{{../name}}{{/goodbyes}}"; var hash = {name: "Alan"}; |