diff options
author | kpdecker <kpdecker@gmail.com> | 2014-01-17 22:56:40 -0600 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2014-01-17 23:09:59 -0600 |
commit | 33921beaa08649f251e9e8b77124cb8fd2c42b1c (patch) | |
tree | dd11ecd57e8850c2f0c6fecad2f105697dd62e02 /spec/basic.js | |
parent | d4cfe90959c5a585e5d87e31038eb2f0432f87a5 (diff) | |
download | handlebars.js-33921beaa08649f251e9e8b77124cb8fd2c42b1c.zip handlebars.js-33921beaa08649f251e9e8b77124cb8fd2c42b1c.tar.gz handlebars.js-33921beaa08649f251e9e8b77124cb8fd2c42b1c.tar.bz2 |
Fix missing parameters for pathed mustaches
Fixes #658
Diffstat (limited to 'spec/basic.js')
-rw-r--r-- | spec/basic.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/basic.js b/spec/basic.js index 245022c..8aa54b9 100644 --- a/spec/basic.js +++ b/spec/basic.js @@ -97,6 +97,18 @@ describe("basic context", function() { frank: "Frank"}, "Frank", "functions are called with context arguments"); }); + it("pathed functions with context argument", function() { + shouldCompileTo("{{bar.awesome frank}}", + {bar: {awesome: function(context) { return context; }}, + frank: "Frank"}, + "Frank", "functions are called with context arguments"); + }); + it("depthed functions with context argument", function() { + shouldCompileTo("{{#with frank}}{{../awesome .}}{{/with}}", + {awesome: function(context) { return context; }, + frank: "Frank"}, + "Frank", "functions are called with context arguments"); + }); it("block functions with context argument", function() { shouldCompileTo("{{#awesome 1}}inner {{.}}{{/awesome}}", @@ -104,11 +116,27 @@ describe("basic context", function() { "inner 1", "block functions are called with context and options"); }); + it("depthed block functions with context argument", function() { + shouldCompileTo("{{#with value}}{{#../awesome 1}}inner {{.}}{{/../awesome}}{{/with}}", + {value: true, awesome: function(context, options) { return options.fn(context); }}, + "inner 1", "block functions are called with context and options"); + }); + it("block functions without context argument", function() { shouldCompileTo("{{#awesome}}inner{{/awesome}}", {awesome: function(options) { return options.fn(this); }}, "inner", "block functions are called with options"); }); + it("pathed block functions without context argument", function() { + shouldCompileTo("{{#foo.awesome}}inner{{/foo.awesome}}", + {foo: {awesome: function(options) { return this; }}}, + "inner", "block functions are called with options"); + }); + it("depthed block functions without context argument", function() { + shouldCompileTo("{{#with value}}{{#../awesome}}inner{{/../awesome}}{{/with}}", + {value: true, awesome: function(options) { return this; }}, + "inner", "block functions are called with options"); + }); it("paths with hyphens", function() { |