From d04ac7886143bb545749732e2a2baeab7de7bc49 Mon Sep 17 00:00:00 2001 From: "stencil-harness[bot]" <353851134+stencil-harness[bot]@users.noreply.github.com> Date: Sat, 21 Nov 2026 15:26:48 -0500 Subject: [PATCH] test: cover chaining built-in {{else with}} under {{#if}} Case taken from #684. Co-Authored-By: Claude Opus 5.5 --- source/Handlebars.Test/ConditionalElseChainTests.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) 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")]