diff options
-rw-r--r-- | lib/Text/Xslate/Syntax/Handlebars.pm | 1 | ||||
-rw-r--r-- | t/block-helpers.t | 56 |
2 files changed, 57 insertions, 0 deletions
diff --git a/lib/Text/Xslate/Syntax/Handlebars.pm b/lib/Text/Xslate/Syntax/Handlebars.pm index 526b0f9..ce21c68 100644 --- a/lib/Text/Xslate/Syntax/Handlebars.pm +++ b/lib/Text/Xslate/Syntax/Handlebars.pm @@ -259,6 +259,7 @@ sub init_symbols { $self->symbol('&')->set_nud($self->can('nud_mark_raw')); $self->symbol('..')->set_nud($self->can('nud_uplevel')); + $self->symbol('..')->lbp(10); $self->infix('=', 20, $self->can('led_equals')); } 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; |