From 3cdf14d2949665a282ea562138b97c8d9f829988 Mon Sep 17 00:00:00 2001 From: kpdecker Date: Tue, 27 May 2014 09:32:29 -0400 Subject: [PATCH] Add test case for Issue #800 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This isn’t failing in master but this is a useful test to prevent regressions. --- spec/subexpressions.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/spec/subexpressions.js b/spec/subexpressions.js index 5d11473b..0ecdbb9d 100644 --- a/spec/subexpressions.js +++ b/spec/subexpressions.js @@ -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}}';