Allow undefined and null in helper names
This commit is contained in:
@@ -74,6 +74,20 @@ describe("basic context", function() {
|
||||
}
|
||||
},
|
||||
'true true object');
|
||||
shouldCompileTo('{{undefined}}',
|
||||
{
|
||||
undefined: function() {
|
||||
return 'undefined!';
|
||||
}
|
||||
},
|
||||
'undefined!');
|
||||
shouldCompileTo('{{null}}',
|
||||
{
|
||||
null: function() {
|
||||
return 'null!';
|
||||
}
|
||||
},
|
||||
'null!');
|
||||
});
|
||||
|
||||
it("newlines", function() {
|
||||
|
||||
@@ -23,7 +23,7 @@ describe('javascript-compiler api', function() {
|
||||
// Tests nameLookup dot vs. bracket behavior. Bracket is required in certain cases
|
||||
// to avoid errors in older browsers.
|
||||
it('should handle reserved words', function() {
|
||||
shouldCompileTo("{{foo}} {{~[null]~}}", { foo: "food" }, "food");
|
||||
shouldCompileTo("{{foo}} {{~null~}}", { foo: "food" }, "food");
|
||||
});
|
||||
});
|
||||
describe('#compilerInfo', function() {
|
||||
|
||||
@@ -58,6 +58,10 @@ describe('parser', function() {
|
||||
equals(ast_for("{{foo false}}"), "{{ PATH:foo [BOOLEAN{false}] }}\n");
|
||||
});
|
||||
|
||||
it('parses mustaches with undefined and null paths', function() {
|
||||
equals(ast_for("{{undefined}}"), "{{ UNDEFINED [] }}\n");
|
||||
equals(ast_for("{{null}}"), "{{ NULL [] }}\n");
|
||||
});
|
||||
it('parses mustaches with undefined and null parameters', function() {
|
||||
equals(ast_for("{{foo undefined null}}"), "{{ PATH:foo [UNDEFINED, NULL] }}\n");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user