Add tests for string contexts

Fixes #1013
This commit is contained in:
kpdecker
2015-05-06 10:47:56 -05:00
parent 8cba84df11
commit 569f288551
2 changed files with 11 additions and 0 deletions
+4
View File
@@ -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!');
+7
View File
@@ -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';