From 931f49b5dae31b1dd4c89947df16951adcf376c1 Mon Sep 17 00:00:00 2001 From: David da Silva Date: Fri, 29 May 2015 21:38:27 +0200 Subject: [PATCH] improve test with undefined/null lookup hit using dot notation --- test/_files/null_lookup_object.js | 15 ++++++++++++++- test/_files/null_lookup_object.mustache | 6 ++++++ test/_files/null_lookup_object.txt | 4 ++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/test/_files/null_lookup_object.js b/test/_files/null_lookup_object.js index 2f758a5..0f82480 100644 --- a/test/_files/null_lookup_object.js +++ b/test/_files/null_lookup_object.js @@ -14,5 +14,18 @@ "name": "Chris", "twitter": undefined } - ] + ], + "favorites": { + "color": "blue", + "president": "Bush", + "show": "Futurama" + }, + "mascot": { + "name": "Squid", + "favorites": { + "color": "orange", + "president": undefined, + "show": null + } + } }) diff --git a/test/_files/null_lookup_object.mustache b/test/_files/null_lookup_object.mustache index e709ae4..243e218 100644 --- a/test/_files/null_lookup_object.mustache +++ b/test/_files/null_lookup_object.mustache @@ -1,3 +1,9 @@ {{#fobject}} {{name}}'s twitter: {{#twitter}}{{.}}{{/twitter}}{{^twitter}}unknown{{/twitter}}. {{/fobject}} + +{{#mascot}} +{{name}}'s favorite color: {{#favorites.color}}{{.}}{{/favorites.color}}{{^favorites.color}}no one{{/favorites.color}}. +{{name}}'s favorite president: {{#favorites.president}}{{.}}{{/favorites.president}}{{^favorites.president}}no one{{/favorites.president}}. +{{name}}'s favorite show: {{#favorites.show}}{{.}}{{/favorites.show}}{{^favorites.show}}none{{/favorites.show}}. +{{/mascot}} diff --git a/test/_files/null_lookup_object.txt b/test/_files/null_lookup_object.txt index c1c727b..0f71bdb 100644 --- a/test/_files/null_lookup_object.txt +++ b/test/_files/null_lookup_object.txt @@ -1,3 +1,7 @@ Flor's twitter: @florrts. Miquel's twitter: unknown. Chris's twitter: unknown. + +Squid's favorite color: orange. +Squid's favorite president: no one. +Squid's favorite show: none.