You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Very weird behavior inside of a partial with an #each after passing in a custom context to that partial #432
In the below code, the value of actual1 is "," and the value of actual2 is ",False,I shouldn't show up!,"
I expected the partial "displayList" to have a new context, which would be null since "TheList" is never assigned. I expected the #each to not iterate through anything.
Test to reproduce
privateclassClassWithAList{publicIEnumerable<string>TheList{get;set;}}privateclassClassWithAListAndOtherMembers{publicIEnumerable<string>TheList{get;set;}publicboolSomeBool{get;set;}publicstringSomeString{get;set;}="I shouldn't show up!";}[Fact]publicvoidWeirdBehaviour(){varhandlebars=Handlebars.Create();handlebars.RegisterTemplate("displayListItem","{{this}},");handlebars.RegisterTemplate("displayList","{{#each this}}{{> displayListItem}}{{/each}}");vartemplate=handlebars.Compile("{{> displayList TheList}}");varactual1=template(newClassWithAList());varactual2=template(newClassWithAListAndOtherMembers());varexpected="";Assert.Equal(expected,actual1);Assert.Equal(expected,actual2);}
Activity