summaryrefslogtreecommitdiffstats
path: root/spec/partials.js
diff options
context:
space:
mode:
authorLon Ingram <lawnsea@gmail.com>2016-08-16 15:47:33 -0500
committerLon Ingram <lawnsea@gmail.com>2016-08-16 18:23:53 -0500
commitbbe0a94d6e5e909361d3f1195b1bc72dc31e233f (patch)
tree41aaa7afc8ba3c8e103e42dd84582b9dd7b7b690 /spec/partials.js
parenta6a0e50551ff7a7f7349ea67d35dcda04ce26cfd (diff)
downloadhandlebars.js-bbe0a94d6e5e909361d3f1195b1bc72dc31e233f.zip
handlebars.js-bbe0a94d6e5e909361d3f1195b1bc72dc31e233f.tar.gz
handlebars.js-bbe0a94d6e5e909361d3f1195b1bc72dc31e233f.tar.bz2
Walk up data frames for nested @partial-block
The root cause of #1218 is that `invokePartial` creates a stack of data frames for nested partial blocks, but `resolvePartial` always uses the value at top of the stack without "popping" it. The result is an infinite recursive loop, as references to `@partial-block` in the partial at the top of the stack resolve to itself. So, walk up the stack of data frames when evaluating. This is accomplished by 1) setting the `partial-block` property to `noop` after use and 2) using `_parent['partial-block']` if `partial-block` is `noop` Fix #1218
Diffstat (limited to 'spec/partials.js')
-rw-r--r--spec/partials.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/partials.js b/spec/partials.js
index d3ead74..07d1c0d 100644
--- a/spec/partials.js
+++ b/spec/partials.js
@@ -270,6 +270,20 @@ describe('partials', function() {
true,
'success');
});
+ it('should render nested partial blocks', function() {
+ shouldCompileToWithPartials(
+ '.template-start.{{#> outer}}{{value}}{{/outer}}.template-end.',
+ [
+ {value: 'success'},
+ {},
+ {
+ outer: '.outer-start.{{#> nested}}.outer-partial-block-start.{{> @partial-block}}.outer-partial-block-end.{{/nested}}.outer-end.',
+ nested: '.nested-start.{{> @partial-block}}.nested-end.'
+ }
+ ],
+ true,
+ '.template-start..outer-start..nested-start..outer-partial-block-start.success.outer-partial-block-end..nested-end..outer-end..template-end.');
+ });
});
describe('inline partials', function() {