Skip to content

1031631: Improved test cases coverage for the InputHidden component in Blazor#67031

Open
BhaskarSuresh22 wants to merge 4 commits into
dotnet:mainfrom
BhaskarSuresh22:inputhidden-testcases
Open

1031631: Improved test cases coverage for the InputHidden component in Blazor#67031
BhaskarSuresh22 wants to merge 4 commits into
dotnet:mainfrom
BhaskarSuresh22:inputhidden-testcases

Conversation

@BhaskarSuresh22
Copy link
Copy Markdown

Description

This PR adds comprehensive unit tests for the Blazor InputHidden component by introducing a suite of new test cases focused on rendering, attribute handling, value binding, and EditContext integration. The changes introduce test patterns that validate both basic rendering behaviors and edge cases for hidden input field components.

InputHiddenTest.cs test cases:

Category Tests Coverage
Rendering & Attributes 9 Element type, id, name, value, type, onchange event
Attribute Overrides 3 Custom id, name, and type override default values
CSS Class Handling 2 CSS class rendering, user-provided class merging
Value Handling 2 Null/empty value rendering, value attribute existence
Field Identifiers & Integration 2 FieldIdentifier creation, EditContext binding
Additional Attributes 1 Multiple custom data attributes preservation

What was added

  • 14 new/modified tests covering core InputHidden functionality and behaviors
  • Tests follow ARRANGE-ACT-ASSERT pattern
  • No breaking changes — purely additive test coverage

Key Improvements

  • Added tests for element rendering — verifies <input type="hidden"> is rendered with correct attributes
  • Attribute override coverage — custom id, name, and type attributes validated
  • Value binding validation — empty, null, and populated values tested
  • EditContext integration — FieldIdentifier creation and model binding verified
  • CSS class handling — user-provided classes merged with validation classes
  • Event binding — onchange event handler presence confirmed
  • RenderTree inspection pattern — consistent frame-based validation approach

Changed Files

Test Results

image

Impact

  • Closes gaps in InputHidden unit-test coverage for rendering and attribute handling
  • Strengthens regression safety for hidden input component behavior
  • Validates EditContext integration for form component consistency
  • No public API changes — purely test additions

PR Checklist

  • Small and focused — Only test improvements for InputHidden
  • Tests added — 14 new test cases
  • Code style matches — Follows existing test patterns
  • Local build passes — Ready for CI
  • Local tests pass — All 14 tests execute successfully
  • No breaking changes — Purely additive
  • Issue linked (if applicable)
  • Public API updates — Not applicable
  • XML documentation — Not applicable

@github-actions github-actions Bot added the area-blazor Includes: Blazor, Razor Components label Jun 5, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jun 5, 2026
@BhaskarSuresh22
Copy link
Copy Markdown
Author

@dotnet-policy-service agree company="Syncfusion, Inc."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants