Describe the bug
When using data that is a mix of Dictionary and List instances and a template string that uses an #each helper nested inside another #each helper call, the template is unable to retrieve dictionary values inside the nested #each.
Expected behavior:
A template string that has a retrieval attempt of a dictionary value within a nested #each call results in that value being written to the final output.
Test to reproduce
(this is taken from this unit test I've written on a fork):
[Theory,ClassData(typeof(HandlebarsEnvGenerator))]publicvoidNestedEachDictionariesLists(IHandlebarshandlebars){varsource=@" {{#each this.users}} {{#each friends}} {{emailAddress}} {{/each}} {{/each}} ";vartemplate=handlebars.Compile(source);varfriends=newList<Dictionary<object,object>>{newDictionary<object,object>{{"emailAddress","foobarbaz@baz.com"}},};varusers=newList<Dictionary<object,object>>{newDictionary<object,object>{{"friends",friends},},};vardata=newDictionary<object,object>{{"users",users},};Assert.Equal("foobarbaz@baz.com",template(data).Trim());}Other related info
The above test fails with the following output:
Error Message:
Assert.Equal() Failure
↓ (pos 0)
Expected: foobarbaz@baz.com
Actual:
↑ (pos 0)
Stack Trace:
at HandlebarsDotNet.Test.BasicIntegrationTests.NestedEachStronglyTyped(IHandlebars handlebars) in /mnt/c/Users/cvirtucio/git/cjvirtucio87-Handlebars.Net/source/Handlebars.Test/BasicIntegrationTests.cs:line 423
Describe the bug
When using data that is a mix of
DictionaryandListinstances and a template string that uses an#eachhelper nested inside another#eachhelper call, the template is unable to retrieve dictionary values inside the nested#each.Expected behavior:
A template string that has a retrieval attempt of a dictionary value within a nested
#eachcall results in that value being written to the final output.Test to reproduce
(this is taken from this unit test I've written on a fork):
Other related info
The above test fails with the following output: