test: rearrange unit tests to one test file per component - #282
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reorganizes the IgniteUI.Blazor.Tests unit-test suite to follow a clearer one-file-per-component layout, dissolving prior “grab-bag” and *ExtendedTests.cs files while keeping coverage intact (and removing exact duplicate facts). It also updates the shipped testing guidance/docs to match the new convention and extracts a shared assertion helper into its own file.
Changes:
- Split mixed/extended test files into per-component suites and moved child-component suites into their parent component’s test file where appropriate.
- Removed exact duplicate tests while keeping the net set of unique assertions.
- Moved
ElementAssertionExtensionsinto a dedicatedElementAssertionExtensions.cshelper file and updated docs/contributing guidance for the new layout.
Reviewed changes
Copilot reviewed 39 out of 39 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/IgniteUI.Blazor.Tests/ToastTests.cs | New per-component suite for IgbToast (moved from shared file). |
| tests/IgniteUI.Blazor.Tests/TextareaTests.cs | Kept Textarea suite focused on IgbTextarea; moved MaskInput out. |
| tests/IgniteUI.Blazor.Tests/TabsTests.cs | Added/moved Tabs child-content rendering fact into the Tabs suite. |
| tests/IgniteUI.Blazor.Tests/SwitchTests.cs | Added/moved Required/Invalid attribute facts into Switch suite. |
| tests/IgniteUI.Blazor.Tests/SnackbarTests.cs | Removed embedded ToastTests class now that ToastTests.cs exists. |
| tests/IgniteUI.Blazor.Tests/SliderTests.cs | Merged former extended slider facts; added SliderLabelTests child suite. |
| tests/IgniteUI.Blazor.Tests/SliderExtendedTests.cs | Deleted (tests moved into SliderTests.cs / other suites). |
| tests/IgniteUI.Blazor.Tests/SelectTests.cs | Merged former extended select facts; added SelectGroupTests/SelectHeaderTests child suites. |
| tests/IgniteUI.Blazor.Tests/SelectExtendedTests.cs | Deleted (tests moved into SelectTests.cs). |
| tests/IgniteUI.Blazor.Tests/RippleTests.cs | New per-component suite for IgbRipple. |
| tests/IgniteUI.Blazor.Tests/RatingTests.cs | Added/moved RatingSymbolTests child suite and rating child-content fact. |
| tests/IgniteUI.Blazor.Tests/ProgressExtendedTests.cs | Deleted (tests moved into the specific component suites like LinearProgressTests, TabsTests, etc.). |
| tests/IgniteUI.Blazor.Tests/NavigationTests.cs | Deleted (split into NavbarTests.cs and NavDrawerTests.cs). |
| tests/IgniteUI.Blazor.Tests/NavDrawerTests.cs | Promoted to main NavDrawerTests with interop contract; kept child item/header-item suites in-file. |
| tests/IgniteUI.Blazor.Tests/NavbarTests.cs | New per-component suite for IgbNavbar. |
| tests/IgniteUI.Blazor.Tests/MaskInputTests.cs | New per-component suite for IgbMaskInput including interop contract runners. |
| tests/IgniteUI.Blazor.Tests/ListTests.cs | Added/moved ListHeader child-content fact into List suite. |
| tests/IgniteUI.Blazor.Tests/LinearProgressTests.cs | Removed embedded CircularProgress suite; added/moved AnimationDuration fact. |
| tests/IgniteUI.Blazor.Tests/InputTests.cs | Merged former extended input facts into InputTests. |
| tests/IgniteUI.Blazor.Tests/InputExtendedTests.cs | Deleted (tests moved into InputTests.cs / other suites). |
| tests/IgniteUI.Blazor.Tests/IconTests.cs | Added/moved Icon child-content fact into IconTests. |
| tests/IgniteUI.Blazor.Tests/ElementAssertionExtensions.cs | New shared helper file for Should_Exist. |
| tests/IgniteUI.Blazor.Tests/DropdownTests.cs | Merged former extended dropdown facts; added DropdownGroupTests/DropdownHeaderTests child suites. |
| tests/IgniteUI.Blazor.Tests/DropdownExtendedTests.cs | Deleted (tests moved into DropdownTests.cs). |
| tests/IgniteUI.Blazor.Tests/DividerTests.cs | New per-component suite for IgbDivider. |
| tests/IgniteUI.Blazor.Tests/DialogExtendedTests.cs | Deleted (tests moved into the appropriate component suites). |
| tests/IgniteUI.Blazor.Tests/CircularProgressTests.cs | New per-component suite for IgbCircularProgress (split from LinearProgressTests.cs). |
| tests/IgniteUI.Blazor.Tests/ChipTests.cs | Added/moved additional StyleVariant facts into ChipTests. |
| tests/IgniteUI.Blazor.Tests/CheckboxTests.cs | Added/moved Invalid attribute fact into CheckboxTests. |
| tests/IgniteUI.Blazor.Tests/CardTests.cs | Added/moved child-content facts for Card* subcomponents into CardTests.cs. |
| tests/IgniteUI.Blazor.Tests/ButtonTests.cs | Removed embedded ElementAssertionExtensions (now in its own file). |
| tests/IgniteUI.Blazor.Tests/BannerTests.cs | New per-component suite for IgbBanner with interop contract runners. |
| tests/IgniteUI.Blazor.Tests/BadgeTests.cs | Added/moved StyleVariant and child-content facts into BadgeTests. |
| tests/IgniteUI.Blazor.Tests/BadgeExtendedTests.cs | Deleted (tests moved into component suites). |
| tests/IgniteUI.Blazor.Tests/AvatarTests.cs | Added/moved Shape_Square and child-content facts into AvatarTests. |
| tests/IgniteUI.Blazor.Tests/AccordionTests.cs | Removed embedded unrelated suites; kept only accordion assertions in file. |
| skills/igniteui-blazor-lite-testing/SKILL.md | Updated guidance to reflect one-file-per-component convention and helper location. |
| skills/igniteui-blazor-lite-testing/references/interop-contracts.md | Updated contract placement guidance to match new file layout. |
| .github/CONTRIBUTING.md | Added/updated contributor guidance to document the new unit-test layout convention. |
Comments suppressed due to low confidence (1)
.github/CONTRIBUTING.md:138
- Spelling/capitalization: "refenrece of the github task" should be "reference of the GitHub task".
4. `<issue>` - The issue is the refenrece of the github task you have. Be aware that you are able to link more than one issue. For instance `(#123 #456)`.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
kdinev
approved these changes
Jul 30, 2026
kdinev
enabled auto-merge (squash)
July 30, 2026 07:14
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.
Breaks up the catch-all files in
tests/IgniteUI.Blazor.Testsso every component has its own suite file. All three TFMs green: 881 passed, 22 skipped, 903 total on net8.0 / net9.0 / net10.0.What changed
Split grab-bag files into per-component files (12 deleted → 12 created):
MiscComponentTests.csAccordionTests.cs,BannerTests.cs,DividerTests.cs,RippleTests.csNavigationTests.csNavbarTests.cs,NavDrawerTests.csAlertTests.csSnackbarTests.cs,ToastTests.csProgressTests.csLinearProgressTests.cs,CircularProgressTests.csTextInputTests.csTextareaTests.cs,MaskInputTests.cs*ExtendedTests.cs(Badge, Dialog, Dropdown, Input, Progress, Select, Slider)The
*Extended*files were the same problem under a different name —BadgeExtendedTestsactually held Badge + Avatar + Chip + Icon + Ripple + Divider facts,ProgressExtendedTestsheld Progress + Rating + List + Tabs + Card. Each fact moved to its component's suite, merged into the existing class rather than a second class, so a component now has one suite with its contract runners and plain bUnit facts side by side.Child-component suites live in their parent's file: new
SelectGroupTests/SelectHeaderTests,DropdownGroupTests/DropdownHeaderTests,SliderLabelTests,RatingSymbolTests,NavDrawerItemTests/NavDrawerHeaderItemTests. Cross-cutting suites (BaseControlTests,*SerializationTests,ScriptPropTests,Interop*Tests) are keyed to a behavior rather than a component and keep their own files.Two things worth a reviewer's attention:
Snackbar_ActionText_RendersAttributeexisted verbatim in bothAlertTestsandDialogExtendedTests; same for Toast display-time/keep-open, Slider bounds, Textarea label/readonly, and the Divider/Ripple render checks. Only facts where property, value, and assertion were identical were removed;[InlineData]count is unchanged at 135, and 761 − 722 = 39 matches the dedup list exactly.ElementAssertionExtensions(Should_Exist) was hidden at the bottom ofButtonTests.cs— moved to its ownElementAssertionExtensions.cs.Docs
skills/igniteui-blazor-lite-testing/SKILL.md— the old convention told you to expect this ("Suites may live per class, instead of per file —BannerTestsis inMiscComponentTests.cs"). Replaced with the one-file-per-component rule, the child-component exception, and the no-second-suite rule.skills/igniteui-blazor-lite-testing/references/interop-contracts.md— same stale pointer ("search for the class, not the file",XTests+XExtendedTests) rewritten..github/CONTRIBUTING.md— added the layout convention under the TDD bullet in New feature development; it had no guidance on where tests go.