diff options
Diffstat (limited to 'spec/regressions.js')
-rw-r--r-- | spec/regressions.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/regressions.js b/spec/regressions.js index 83765a2..9bd00d9 100644 --- a/spec/regressions.js +++ b/spec/regressions.js @@ -247,4 +247,27 @@ describe('Regressions', function() { }; shouldCompileToWithPartials(string, [{}, {}, partials], true, 'Outer'); }); + + it('GH-1135 : Context handling within each iteration', function() { + var obj = {array: [1], name: 'John'}; + var helpers = { + myif: function(conditional, options) { + if (conditional) { + return options.fn(this); + } else { + return options.inverse(this); + } + } + }; + + shouldCompileTo(` + {{#each array}} + 1. IF: {{#if true}}{{../name}}-{{../../name}}-{{../../../name}}{{/if}} + 2. MYIF: {{#myif true}}{{../name}}={{../../name}}={{../../../name}}{{/myif}} + {{/each}} + `, [obj, helpers], ` + 1. IF: John-- + 2. MYIF: John== + `); + }); }); |