summaryrefslogtreecommitdiffstats
path: root/t/blocks.t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-10-05 12:31:26 -0500
committerJesse Luehrs <doy@tozt.net>2012-10-05 12:38:34 -0500
commite8a83edb85216a9f6978a99c77cc196db5cb4c44 (patch)
tree2c59f9ef7ecdbf87919093812576ca9872e4520d /t/blocks.t
parent9191972488f91494a77025d27a2150a202dd0c1c (diff)
downloadtext-handlebars-e8a83edb85216a9f6978a99c77cc196db5cb4c44.tar.gz
text-handlebars-e8a83edb85216a9f6978a99c77cc196db5cb4c44.zip
implement {{^}} as an alias for {{else}}
Diffstat (limited to 't/blocks.t')
-rw-r--r--t/blocks.t45
1 files changed, 45 insertions, 0 deletions
diff --git a/t/blocks.t b/t/blocks.t
index e34ef36..153a8a9 100644
--- a/t/blocks.t
+++ b/t/blocks.t
@@ -70,4 +70,49 @@ render_ok(
"empty block"
);
+{ local $TODO = "unimplemented";
+render_ok(
+ '{{#people}}{{name}}{{^}}{{none}}{{/people}}',
+ {
+ none => 'No people',
+ },
+ 'No people',
+ "inverted block shorthand"
+);
+
+render_ok(
+ '{{#people}}{{name}}{{^}}{{none}}{{/people}}',
+ {
+ none => 'No people',
+ people => [],
+ },
+ 'No people',
+ "inverted block shorthand (empty array)"
+);
+
+render_ok(
+ <<'TEMPLATE',
+{{#people}}
+{{name}}
+{{^}}
+{{none}}
+{{/people}}
+TEMPLATE
+ {
+ none => 'No people',
+ people => [
+ 'Jesse Luehrs',
+ 'Shawn Moore',
+ 'Stevan Little',
+ ],
+ },
+ <<'RENDERED',
+Jesse Luehrs
+Shawn Moore
+Stevan Little
+RENDERED
+ "inverted block shorthand (non-empty array)"
+);
+}
+
done_testing;