Repository navigation
Enhance InputSelect tests by adding edge case scenarios - #67015
karmegams02 wants to merge 21 commits into
Conversation
|
@dotnet-policy-service agree company="Syncfusion, Inc." |
lewing
left a comment
There was a problem hiding this comment.
Thanks for the contribution, @karmegams02 — there are genuinely valuable additions here, especially around bool? parsing, nullable-empty handling, and EditContext.IsModified tracking, which were previously uncovered. Requesting changes on a couple of scope items and one consolidation suggestion before merge.
🚩 Please address (out of scope for an "add tests" PR)
-
Revert the
TestEnum.Tree→TestEnum.Threerename (InputSelectTest.cs:260).
This rename isn't mentioned in the PR description and isn't required by any of the new tests exceptChangingValueMultipleTimesAlwaysReflectsLatestValue, which can use the existingTreevalue instead. Renames to pre-existing test infrastructure should land as a separate, clearly-scoped PR. -
Revert the
Single→SingleOrDefaultchange inRendersIdAttribute(InputSelectTest.cs:229).
That test was passing onmainwith the stricterSingleinvariant ("exactly oneidattribute frame"). Relaxing the assertion isn't necessary for any of the new tests, and weakens an existing precondition. If a new test breaks underSingle, that's worth investigating rather than working around.
✂️ Please dedupe (functionally identical to existing tests)
ParsesNotNullableEnumWithExactNameMatchandParsesNullableEnumWithExactNameMatchare duplicates of the existingParsesCurrentValueWhenUsingNotNullableEnumWithNotEmptyValue/ParsesCurrentValueWhenUsingNullableEnumWithNotEmptyValue— same input ("Two"/"One"), same assertion. The only difference is the async wrapperSetCurrentValueAsStringAsync, which just dispatches the same write throughInvokeAsync— no new behavior is covered. Please delete both.
💡 Optional but recommended
The three attribute-pass-through tests (ClassAttributeIsPassedThroughViaAdditionalAttributes, DataAttributesArePassedThroughViaAdditionalAttributes, AriaAttributesArePassedThroughViaAdditionalAttributes) all exercise the same single line in production (builder.AddMultipleAttributes(1, AdditionalAttributes) in InputSelect.cs). Consider collapsing into one [Theory] over the three attribute families — cuts ~100 lines without losing coverage. Same applies to the multi-select pair (MultiSelectWithStringArrayRendersMultipleAttribute + SingleSelectDoesNotRenderMultipleAttribute).
Thanks again — the nullable-bool and validation-lifecycle tests are real coverage gains and worth landing.
|
Hi @lewing , thank you for your valuable feedback and detailed review. |
|
Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime. |
|
/review |
There was a problem hiding this comment.
Source-only review of frozen head ef3201d983bfcbcfd53f32dda929cdfcfa9f3d59 found two P3 test false-pass risks: the nullable-empty tests never initialize the component with their non-null model values, and the invalid-value retention tests begin at the type default.
Both routed guides completed independently: docs/CrossCuttingGuidance.md and docs/BlazorComponentsGuidance.md. The sole changed file was covered by both guides; no materially changed area was uncovered. Target execution, tests, CI, browser workflows, and security assessment were excluded by the trusted source-only review policy.
The complete prepared feedback contained no duplicate of these findings; earlier feedback covered separate scope and deduplication issues. There are no unresolved candidates. Evidence came only from the immutable version-2 bundle for head ef3201d983bfcbcfd53f32dda929cdfcfa9f3d59, merge base 59d3bac310685ce1e60b07e4893f9083f54c50f1, base tip and reviewer guidance commit 4f556f73a610b386e5ec29355a300e493d30c4c5. No target code or tests were executed. Limitations: tracked frozen Git bytes only, no feedback posted after bundle preparation, and no target behavior behind symlink/submodule/LFS pointers.
Generated by ASP.NET Core Pull Request Review for #67015 · copilot · gpt56 · 187.5 AIC · ⌖ 18.4 AIC · ⊞ 19.5K
Comment /review to run again
There was a problem hiding this comment.
🟡 Changes recommended
The nullable input tests start with null rather than the model’s non-null values, so their null assertions can pass even if empty input leaves the value unchanged.
1 open issue
What changed in this PR
Expands unit coverage for Blazor’s InputSelect component without changing production code.
Changes:
- Adds parsing, nullable-value, validation lifecycle, and repeated-selection tests.
- Checks attribute pass-through, single- and multi-select rendering, and event-handler registration.
- Strengthens the existing element-reference test with an explicit no-exception assertion.
| File | Description |
|---|---|
src/Components/Web/test/Forms/InputSelectTest.cs |
Adds edge-case tests and supporting models for input values, validation, and rendering. |
Review effort: Balanced
|
/review |
|
Thanks for adding these tests. What specific regression or coverage gap are they addressing? I do not see a linked issue or product change, so I would like to understand the reason for this expansion. |
|
Hi @kotlarmilos , These tests were added early in the development phase to improve coverage in areas that had lower test coverage. They are not related to any specific issue or product change. The goal was to improve overall test coverage and help prevent future regressions. |
|
To keep CI cost under control, I suggest closing this PR unless we see regressions. |

Summary
This PR significantly enhances the test coverage for
Microsoft.AspNetCore.Components.Forms.InputSelectcomponent by:Changes
src/Components/Web/test/Forms/InputSelectTest.cs<select>rendering, onchange binding)Testing