Ensure that programs always return strings

Fixes #1838
This commit is contained in:
Nils Knappmeier
2023-08-06 17:22:32 +02:00
parent 520e1d5f08
commit b0c01541e2
2 changed files with 22 additions and 1 deletions
+21
View File
@@ -34,6 +34,7 @@ describe('javascript-compiler api', function() {
.toCompileTo('food');
});
});
describe('#compilerInfo', function() {
var $superCheck, $superInfo;
beforeEach(function() {
@@ -58,6 +59,7 @@ describe('javascript-compiler api', function() {
.toCompileTo('food ');
});
});
describe('buffer', function() {
var $superAppend, $superCreate;
beforeEach(function() {
@@ -116,4 +118,23 @@ describe('javascript-compiler api', function() {
});
});
});
describe('options', function() {
it('should append `noEscape` statements as string', function() {
expectTemplate('{{a}}{{b}}')
.withCompileOptions({ noEscape: true })
.withInput({ a: 1, b: 1 })
.toCompileTo('11');
});
it('should append `noEscape` statements as string in a block', function() {
expectTemplate('{{#block}}{{a}}{{b}}{{/block}}')
.withCompileOptions({ noEscape: true })
.withHelper('block', function(options) {
return options.fn(this);
})
.withInput({ a: 1, b: 1 })
.toCompileTo('11');
});
});
});