Repository navigation
test: cover chaining built-in {{else with}} under {{#if}} - #689
Merged
Merged
Conversation
Case taken from #684. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
This was referenced Nov 21, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Refs #683. Follow-up to #687. This PR changes tests only; there are no library changes.
Adds
IfChainsToBuiltInWithHelpertosource/Handlebars.Test/ConditionalElseChainTests.cs. It checks that{{#if a}}A{{else with b}}{{c}}{{/if}}chains to the built-inwithhelper, so{{c}}resolves againstb. The case comes from #684 (by @EnesKartal). It was the one scenario in #684's tests that #687 didn't already cover.#684 vs. merged #687 (actual runs of both)
{{#if a}}A{{else ifEq b "x"}}B{{else}}C{{/if}}BB{{#if a}}A{{else ifEq b "y"}}B{{/if}}{{#if a}}A{{else unless b}}B{{else}}C{{/if}}BB{{#if a}}A{{else if b includeZero=true}}B{{else}}C{{/if}}BB{{#if a}}A{{else if b c}}B{{/if}}HandlebarsCompilerExceptionHandlebarsCompilerException{{#if a}}A{{else}}B{{else}}C{{/if}}HandlebarsCompilerExceptionArgumentNullException{{#if a}}A{{else if}}B{{/if}}B(unchanged from before)HandlebarsCompilerException{{#if a}}A{{else isAdmin}}B{{/if}}B(unchanged from before){{#if a}}A{{else items}}[{{this}}]{{/if}}[{ a = False, … }](unchanged)[1][2]{{#if a}}A{{else "x" b}}B{{/if}}BBoth PRs fix the reported bug. #687 additionally turns the double-
{{else}}case into aHandlebarsCompilerException. The two diverge only where a bare{{else name}}has no further arguments. #687 keeps the existing behaviour there, while #684 switches to handlebars.js semantics. That switch changes output for templates that compile today, so it has been raised separately on #683 as an owner decision rather than shipped here.Full suite:
dotnet test source/Handlebars.Test/Handlebars.Test.csproj: 2271 passed, 0 failed.🤖 Generated with Claude Code
Closes #683