Skip to content

Commit 569f288

Browse files
committed
Add tests for string contexts
Fixes #1013
1 parent 8cba84d commit 569f288

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

spec/basic.js

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ describe('basic context', function() {
2222
'It works if all the required keys are provided');
2323
});
2424

25+
it('compiling with a string context', function() {
26+
shouldCompileTo('{{.}}{{length}}', 'bye', 'bye3');
27+
});
28+
2529
it('compiling with an undefined context', function() {
2630
shouldCompileTo('Goodbye\n{{cruel}}\n{{world.bar}}!', undefined, 'Goodbye\n\n!');
2731

spec/partials.js

+7
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ describe('partials', function() {
4141
'Partials can be passed a context');
4242
});
4343

44+
it('partials with string context', function() {
45+
var string = 'Dudes: {{>dude "dudes"}}';
46+
var partial = '{{.}}';
47+
var hash = {};
48+
shouldCompileToWithPartials(string, [hash, {}, {dude: partial}], true, 'Dudes: dudes');
49+
});
50+
4451
it('partials with undefined context', function() {
4552
var string = 'Dudes: {{>dude dudes}}';
4653
var partial = '{{foo}} Empty';

0 commit comments

Comments
 (0)