Add test case for Issue #800

This isn’t failing in master but this is a useful test to prevent regressions.
This commit is contained in:
kpdecker
2014-05-27 09:32:29 -04:00
parent efad61b1b7
commit 3cdf14d294
+18
View File
@@ -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}}';