diff --git a/source/Handlebars.Test/ConditionalElseChainTests.cs b/source/Handlebars.Test/ConditionalElseChainTests.cs index 008ae2e4..7540130f 100644 --- a/source/Handlebars.Test/ConditionalElseChainTests.cs +++ b/source/Handlebars.Test/ConditionalElseChainTests.cs @@ -142,6 +142,16 @@ public void ElseWithOnlyANameStillRendersAsPlainElse(string source) Assert.Equal("B", template(new { a = false })); } + // Case contributed in https://github.com/Handlebars-Net/Handlebars.Net/pull/684 + [Fact] + public void IfChainsToBuiltInWithHelper() + { + var template = CreateWithHelpers().Compile("{{#if a}}A{{else with b}}{{c}}{{/if}}"); + + Assert.Equal("A", template(new { a = true, b = new { c = "X" }, c = "outer" })); + Assert.Equal("X", template(new { a = false, b = new { c = "X" }, c = "outer" })); + } + [Theory] [InlineData(false, false, "A")] [InlineData(true, false, "B")]