Skip to content

Commit

Permalink
Add test case for Issue #800
Browse files Browse the repository at this point in the history
This isn’t failing in master but this is a useful test to prevent regressions.
  • Loading branch information
kpdecker committed May 27, 2014
1 parent efad61b commit 3cdf14d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spec/subexpressions.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,24 @@ describe('subexpressions', function() {
shouldCompileTo(string, [context, helpers], "val is true");
});

it('GH-800 : Complex subexpressions', function() {
var context = {a: 'a', b:'b', c:{c:'c'}, d:'d', e: {e: 'e'}};
var helpers = {
dash: function(a, b) {
return a + "-" + b;
},
concat: function(a, b) {
return a + b;
}
};

shouldCompileTo('{{dash "abc" (concat a b)}}', [context, helpers], 'abc-ab');
shouldCompileTo('{{dash d (concat a b)}}', [context, helpers], 'd-ab');
shouldCompileTo('{{dash c.c (concat a b)}}', [context, helpers], 'c-ab');
shouldCompileTo('{{dash (concat a b) c.c}}', [context, helpers], 'ab-c');
shouldCompileTo('{{dash (concat a e.e) c.c}}', [context, helpers], 'ae-c');
});

it("provides each nested helper invocation its own options hash", function() {
var string = '{{equal (equal true true) true}}';

Expand Down

0 comments on commit 3cdf14d

Please sign in to comment.