summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-04-16 15:07:54 -0400
committerJesse Luehrs <doy@tozt.net>2014-04-16 15:07:54 -0400
commitbbc3100461494d371d839ca931088f4840ddf9f5 (patch)
tree8abfe334b1930ad3d859fa312eb8162a41e0b8b3 /t
parent9351eb8c985f94625bf4244f58ed1035d2b226c1 (diff)
downloadtext-handlebars-bbc3100461494d371d839ca931088f4840ddf9f5.tar.gz
text-handlebars-bbc3100461494d371d839ca931088f4840ddf9f5.zip
treat '..' like any other name (RT#94792)
../../foo should be valid anywhere that baz/bar/foo is valid, so the '..' token should have the same lbp as names
Diffstat (limited to 't')
-rw-r--r--t/block-helpers.t56
1 files changed, 56 insertions, 0 deletions
diff --git a/t/block-helpers.t b/t/block-helpers.t
index 3cd6cb8..52e275f 100644
--- a/t/block-helpers.t
+++ b/t/block-helpers.t
@@ -472,4 +472,60 @@ render_ok(
"helper with inverse (inverse has variables)"
);
+render_ok(
+ <<TEMPLATE,
+{{#each list}}
+<li>
+{{#each doc}}
+<div>{{this}}</div>
+<span>{{../../info}}</span>
+{{/each}}
+</li>
+{{/each}}
+TEMPLATE
+ {
+ info => "hello world",
+ list => [ { "doc" => [ "a", "b", "c" ] } ],
+ },
+ <<RENDERED,
+<li>
+<div>a</div>
+<span>hello world</span>
+<div>b</div>
+<span>hello world</span>
+<div>c</div>
+<span>hello world</span>
+</li>
+RENDERED
+ "object hierarchy access (RT#94792)"
+);
+
+render_ok(
+ <<TEMPLATE,
+{{#each list}}
+<li>
+{{#each doc}}
+<div>{{this}}</div>
+{{#each ../../info}}<span>{{this}}</span>{{/each}}
+{{/each}}
+</li>
+{{/each}}
+TEMPLATE
+ {
+ info => [ "hello", "world" ],
+ list => [ { "doc" => [ "a", "b", "c" ] } ],
+ },
+ <<RENDERED,
+<li>
+<div>a</div>
+<span>hello</span><span>world</span>
+<div>b</div>
+<span>hello</span><span>world</span>
+<div>c</div>
+<span>hello</span><span>world</span>
+</li>
+RENDERED
+ "object hierarchy access (RT#94792)"
+);
+
done_testing;