Conversation
…logical-shouldnotbenull-assertions
phmatray
marked this pull request as ready for review
September 24, 2026 09:21
phmatray
deleted the
test/478-replace-tautological-shouldnotbenull-assertions
branch
September 24, 2026 09:24
This was referenced Sep 24, 2026
phmatray
added a commit
that referenced
this pull request
Sep 24, 2026
…#483) (#489) * fix(core): resolve DisabledCondition in the core stub field renderers The seven core stub renderers under FormCraft/Forms/Rendering/ read Context.Field.IsDisabled directly, so .DisabledWhen(...) had no effect on the no-adapter-registered fallback path even though FieldComponentBase.IsDisabled already resolves it correctly for both UI adapters (#479). Apply the same expression here: Context.Field.DisabledCondition?.Invoke(Context.Model) ?? Context.Field.IsDisabled Also stub IFieldConfiguration.DisabledCondition to null in the existing Fake-based test helpers across these seven test files: FakeItEasy returns a dummy Func<TModel,bool> (not null) for an unconfigured delegate property, and invoking it returns false, which was silently overriding an explicitly stubbed IsDisabled=true once the renderers started reading DisabledCondition first. Closes #483 * test(core): replace internal-state assertions with rendered-DOM checks FileUploadFieldRendererTests had two pre-existing assertions that checked internal state rather than rendered output (out of scope for #478/#486, which targeted ShouldNotBeNull()): - Render_WithMultipleFilesConfiguration_ConfiguresForMultipleUpload asserted uploadConfig.Multiple.ShouldBeTrue() — an Arrange-time fact about the config object, not the rendered DOM. Replaced with a DOM assertion that "accept" stays absent, consistent with the sibling tests' documented fact that this stub never reads FileUploadConfiguration. - Render_ClearsValidationErrors_OnSuccessfulUpload asserted additionalAttributes.ShouldNotContainKey("FileUploadErrors") against a dict the renderer never touches. Replaced with a DOM assertion that "multiple" stays absent, matching the same fixed-markup fact already established in the file's other CurrentValue-driven tests. Closes #488 * fix: address code-review findings - FileUploadFieldRendererTests: give the two rendered-DOM replacement assertions (#488) something real to pin instead of proving "nothing is emitted from nothing" — set AcceptedFileTypes on the FileUploadConfiguration the "accept" assertion checks against, and stub ActualFieldType so the "multiple" assertion actually reflects a single-file scenario. - CoreRendererDisabledWhenTests: assert the file-upload facts render an <input type="file"> in addition to the disabled state, so a future regression that accidentally resolved a different renderer for the field would be caught rather than silently asserting on the wrong element.
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.
Implements #478.
Closes #478.
Executed the implementation plan task-by-task; each task's checkboxes are ticked on the issue and mirrored below. Ran a three-axis review (Standards / Spec / Verification) via read-only, isolated sub-agents and applied the one real finding before flipping ready.
Plan
Fixed along the way
fix: address code-review findings—IntFieldRendererTests.Render_Should_Handle_Boolean_As_Numeric_Valueasserted only that avalueattribute was present for a boolCurrentValue, not that it carried no literal text (the comment's own claim); addedGetAttribute("value").ShouldBeNullOrEmpty()to actually verify it.Follow-ups
FileUploadFieldRendererTests.cs:Render_WithMultipleFilesConfiguration_ConfiguresForMultipleUploadkeeps a pre-existinguploadConfig.Multiple.ShouldBeTrue()assertion that checks the Arrange-time config object, not the rendered DOM;Render_ClearsValidationErrors_OnSuccessfulUploadkeeps a pre-existingadditionalAttributes.ShouldNotContainKey("FileUploadErrors")check on a dictionary the renderer never touches. Neither was aShouldNotBeNull()call, so both were out of this issue's explicit scope (test(core): replace tautological renderFragment.ShouldNotBeNull() assertions with real DOM facts #478 targets only the ~140ShouldNotBeNull()assertions) — worth a follow-up test-quality pass.Render_WithCurrentValueAsList_HandlesMultipleFilesassertsmultipleis absent becauseActualFieldTypeisn't stubbed in that test). Renaming was explicitly out of scope here (the issue's Spec requires "maintain existing test structure and naming"), so this is left for a future pass.Review recap
Placeholderassertions; empirically verified via an actual test run that unconfiguredstringproperties on these fakes default to"", notnull— independently corroborated by the Verification-axis pass), 1 dismissed (helper-extraction suggestion; matches this repo's own repetitive per-[Fact]test style).ShouldNotBeNull()replaced) and the seam requirement (assertions go through the rendered DOM, never private state) both confirmed. AC3 (suites pass) confirmed by an actualdotnet testrun, not just review. One accepted, necessary deviation: a few tests extract a singleDateTime.Today/attribute value into a local so Arrange and the assertion compare the identical value, which is required for the assertion to be valid rather than scope creep.