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
I'm attaching the code sample below about the issue i'm experiencing
[TestMethod]
public void Handlebar_Test_3()
{
var template =
"{{#home}}Welcome Home{{/home}}{{^home}}Welcome to {{newCity}}{{/home}}";
var data = new Dictionary<string,object>();
data["newCity"] = "New York City";
data["oldCity"] = "Los Angelos ";
data["home"] = false;
var compiler = Handlebars.Compile(template);
var result = compiler.Invoke(data);
Assert.AreEqual("Welcome to New York City", result);
}
The result is
Expected:<Welcome to New York City>. Actual:<Welcome to >.
The text was updated successfully, but these errors were encountered:
I had to go back to the Handlebars and Mustache specs to try to understand this one, and I'm still having a bit of a hard time. The #key syntax denotes a "section", which is supposed to use the non-falsy value as the context for the inner block. But in this case the value is a boolean and the context inside the block is still actually the parent context. So we may need to look at the actual implementation to understand if there is some type checking going on, or something else.
Based on some further investigation, it looks like the JS library is indeed doing a very specific type check on the section key, and if the value is a boolean type it treats the section expression as an if-block instead of a with-block or an iterator block.
This specific check has not been implemented in the .NET library.
Hello,
I'm attaching the code sample below about the issue i'm experiencing
The result is
The text was updated successfully, but these errors were encountered: