From 569f2885513d078bbd56128edbb948f130de3097 Mon Sep 17 00:00:00 2001 From: kpdecker Date: Wed, 6 May 2015 10:47:56 -0500 Subject: [PATCH] Add tests for string contexts Fixes #1013 --- spec/basic.js | 4 ++++ spec/partials.js | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/spec/basic.js b/spec/basic.js index f9b781b4..49ebbe52 100644 --- a/spec/basic.js +++ b/spec/basic.js @@ -22,6 +22,10 @@ describe('basic context', function() { 'It works if all the required keys are provided'); }); + it('compiling with a string context', function() { + shouldCompileTo('{{.}}{{length}}', 'bye', 'bye3'); + }); + it('compiling with an undefined context', function() { shouldCompileTo('Goodbye\n{{cruel}}\n{{world.bar}}!', undefined, 'Goodbye\n\n!'); diff --git a/spec/partials.js b/spec/partials.js index 22d2dc95..b2fc9e07 100644 --- a/spec/partials.js +++ b/spec/partials.js @@ -41,6 +41,13 @@ describe('partials', function() { 'Partials can be passed a context'); }); + it('partials with string context', function() { + var string = 'Dudes: {{>dude "dudes"}}'; + var partial = '{{.}}'; + var hash = {}; + shouldCompileToWithPartials(string, [hash, {}, {dude: partial}], true, 'Dudes: dudes'); + }); + it('partials with undefined context', function() { var string = 'Dudes: {{>dude dudes}}'; var partial = '{{foo}} Empty';