Skip to content

Commit

Permalink
Add tests for string contexts
Browse files Browse the repository at this point in the history
Fixes #1013
  • Loading branch information
kpdecker committed May 6, 2015
1 parent 8cba84d commit 569f288
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions spec/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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!');

Expand Down
7 changes: 7 additions & 0 deletions spec/partials.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 569f288

Please sign in to comment.