summaryrefslogtreecommitdiffstats
path: root/spec/basic.js
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2013-11-03 10:54:24 -0600
committerkpdecker <kpdecker@gmail.com>2013-11-03 10:58:37 -0600
commitded0a1617fda248252a92d71b12c62a5e8536c33 (patch)
tree62ee34c5f6d749365872bd8f37a74a1431d66017 /spec/basic.js
parent88fefc1521641084d18fe1abf9697a852eedf28c (diff)
downloadhandlebars.js-ded0a1617fda248252a92d71b12c62a5e8536c33.zip
handlebars.js-ded0a1617fda248252a92d71b12c62a5e8536c33.tar.gz
handlebars.js-ded0a1617fda248252a92d71b12c62a5e8536c33.tar.bz2
Protect context-lookups from undefined values
Fixes #166 Fixes #587
Diffstat (limited to 'spec/basic.js')
-rw-r--r--spec/basic.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/basic.js b/spec/basic.js
index 4ee65ef..ee154a1 100644
--- a/spec/basic.js
+++ b/spec/basic.js
@@ -22,6 +22,12 @@ describe("basic context", function() {
"It works if all the required keys are provided");
});
+ it("compiling with an undefined context", function() {
+ shouldCompileTo("Goodbye\n{{cruel}}\n{{world.bar}}!", undefined, "Goodbye\n\n!");
+
+ shouldCompileTo("{{#unless foo}}Goodbye{{../test}}{{test2}}{{/unless}}", undefined, "Goodbye");
+ });
+
it("comments", function() {
shouldCompileTo("{{! Goodbye}}Goodbye\n{{cruel}}\n{{world}}!",
{cruel: "cruel", world: "world"}, "Goodbye\ncruel\nworld!",