Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands and standardizes the WebUI test suite by adding new unit tests for additional controls/templates, improving null-handling patterns, and aligning test structure/comments for clarity and consistency.
Changes:
- Added multiple new unit test classes covering additional WebControl components (e.g., View/Tab/Kanban/Dashboard, table templates).
- Refactored many existing tests to use consistent Arrange/Act/Validation sections and updated null checks to pattern-matching (
is null/is not null). - Updated/add documentation for JS components (new rating docs; tree docs table formatting).
Reviewed changes
Copilot reviewed 178 out of 535 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlView.cs | Adds unit tests for ControlView rendering and child-item behavior. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlToolbarItemDivider.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlToolbar.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlToolBarItemLabel.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlTile.cs | Adds coverage (e.g., LargeIcon) and standardizes test sections. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlText.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlTableTemplateText.cs | Adds unit tests for the text table template control. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlTableTemplateTag.cs | Adds unit tests for the tag table template control. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlTableTemplateSelection.cs | Adds unit tests for the selection table template control. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlTableTemplateRating.cs | Adds unit tests for the rating table template control. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlTableTemplateNumeric.cs | Adds unit tests for the numeric table template control. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlTableTemplateMove.cs | Adds unit tests for the move table template control. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlTableTemplateEditor.cs | Adds unit tests for the editor table template control. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlTableTemplateCombo.cs | Adds unit tests for the combo table template control. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlTableTemplateColor.cs | Adds unit tests for the color table template control. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlTableColumnTemplate.cs | Updates tests for icon null checks and expected date template rendering. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlTableColumn.cs | Standardizes sections, updates icon null checks, and removes a test case. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlTabView.cs | Adds unit tests for ControlTabView rendering, title, icon, and add behavior. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlTab.cs | Adds unit tests for ControlTab rendering and child add behavior. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlSplitButtonItemHeader.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlSplitButtonItemDivider.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlSmartEdit.cs | Standardizes sections and updates null checks for UriEndpoint. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlSidebarItemHeader.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlSidebarItemDynamic.cs | Standardizes sections and updates icon null checks. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlSidebarItemDivider.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlSidebarItemControl.cs | Standardizes sections and updates icon null checks. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlSidebar.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlSearchContent.cs | Standardizes sections and updates icon null checks. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlSearch.cs | Standardizes sections and updates icon null checks. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlResponsive.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlQuickfilter.cs | Adds unit tests for ControlQuickfilter. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlPanelTool.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlPanelToast.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlPanelOverflow.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlPanelNavbar.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlPanelMain.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlPanelHeader.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlPanelGrid.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlPanelFooter.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlPanelCenter.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlPanelCallout.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlPanel.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlPagination.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlNavigationItemHeader.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlNavigation.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlMultipleProgressBar.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlModalRemotePage.cs | Standardizes sections and updates selector expectation format. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlModalRemoteForm.cs | Standardizes sections and updates selector expectation format. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlModalForm.cs | Standardizes sections (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlModal.cs | Standardizes sections (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlListItemButton.cs | Adds tests for primary/secondary actions and standardizes sections. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlList.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlLinkList.cs | Standardizes sections and updates icon null checks. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlLine.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlKanban.cs | Adds unit tests for ControlKanban columns/swimlanes/cards. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlImage.cs | Standardizes sections and updates UriEndpoint null check style. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlIcon.cs | Standardizes sections and updates icon null checks. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlHtml.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlFrame.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlFormItemStaticText.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlFormItemPrepend.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlFormItemPanel.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlFormItemLabel.cs | Updates expected markup (adds wx-form-label) and standardizes sections. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlFormItemInputHidden.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlFormItemInputGroup.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlFormItemInputFile.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlFormItemInputDateRange.cs | Standardizes sections and uses is not null in value parsing. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlFormItemInputDate.cs | Standardizes sections and uses is not null in value parsing. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlFormItemInputCalendarRange.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlFormItemInputCalendar.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlFormItemHelpText.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlFormItemGroupVertical.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlFormItemGroupMix.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlFormItemGroupHorizontal.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlFormItemGroupColumnVertical.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlFormItemGroupColumnMix.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlFormItemGroupColumnHorizontal.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlFormInline.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlFileList.cs | Standardizes sections and updates icon null checks. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlDropdownItemHeader.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlDropdownItemDivider.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlDashboard.cs | Adds unit tests for ControlDashboard columns/widgets. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlColor.cs | Adds unit tests for ControlColor value/tooltip behavior. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlCode.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlCarousel.cs | Standardizes sections and adds explicit validation comments. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlCanvas.cs | Standardizes test section comments (arrange/act). |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlBadge.cs | Standardizes sections and updates UriEndpoint null check style. |
| src/WebExpress.WebUI.Test/WebControl/UnitTestControlAlert.cs | Updates dismiss button expectations and standardizes sections. |
| src/WebExpress.WebUI.Test/TestSectionFragmentControlView.cs | Adds a test ISection for fragment-based tests. |
| src/WebExpress.WebUI.Test/TestSectionFragmentControlTile.cs | Adds a test ISection for fragment-based tests. |
| src/WebExpress.WebUI.Test/TestSectionFragmentControlTab.cs | Adds a test ISection for fragment-based tests. |
| src/WebExpress.WebUI.Test/TestSectionFragmentControlSidebarItemIcon.cs | Adds a test ISection for fragment-based tests. |
| src/WebExpress.WebUI.Test/TestSectionFragmentControlQuickfilter.cs | Adds a test ISection for fragment-based tests. |
| src/WebExpress.WebUI.Test/TestSectionFragmentControlKanban.cs | Adds a test ISection for fragment-based tests. |
| src/WebExpress.WebUI.Test/TestSectionFragmentControlDashboard.cs | Adds a test ISection for fragment-based tests. |
| src/WebExpress.WebUI.Test/TestSectionFragmentControlAttribute.cs | Adds a test ISection for fragment-based tests. |
| src/WebExpress.WebUI.Test/TestPage.cs | Uses is null checks for argument validation. |
| src/WebExpress.WebUI.Test/TestFragmentControlView.cs | Adds a fragment type to support view fragment tests. |
| src/WebExpress.WebUI.Test/TestFragmentControlTile.cs | Adds a fragment type to support tile fragment tests. |
| src/WebExpress.WebUI.Test/TestFragmentControlTab.cs | Adds a fragment type to support tab fragment tests. |
| src/WebExpress.WebUI.Test/TestFragmentControlSidebarItemIcon.cs | Adds a fragment type to support sidebar-icon fragment tests. |
| src/WebExpress.WebUI.Test/TestFragmentControlQuickfilter.cs | Adds a fragment type to support quickfilter fragment tests. |
| src/WebExpress.WebUI.Test/TestFragmentControlKanban.cs | Adds a fragment type to support kanban fragment tests. |
| src/WebExpress.WebUI.Test/TestFragmentControlDashboard.cs | Adds a fragment type to support dashboard fragment tests. |
| src/WebExpress.WebUI.Test/TestFragmentControlAttribute.cs | Adds a fragment type to support attribute fragment tests. |
| src/WebExpress.WebUI.Test/TestConditionAlwaysFalse.cs | Updates condition signature to accept IRequest. |
| src/WebExpress.WebUI.Test/TestApplication.cs | Uses is null check for constructor argument validation. |
| src/WebExpress.WebUI.Test/IHtmlNodeExtensions.cs | Uses is null for extension method null handling. |
| src/WebExpress.WebUI.Test/Fixture/UnitTestControlFixture.cs | Changes request mock factory to return IRequest. |
| src/WebExpress.WebUI.Test/Fixture/AssertExtensions.cs | Refactors placeholder equality helper to use pattern-matching null checks. |
| docs/js/tree.md | Reworks attribute table formatting. |
| docs/js/rating.md | Adds documentation for the rating controller/component. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| // validation | ||
| var html = control.Render(context, visualTree); | ||
| var expected = @"<div class=""wx-webui-kanban""><div id=""a"" class=""wx-swimlane"" data-label=""A"" data-expanded=""false""></div></div>"; |
There was a problem hiding this comment.
The test passes true for the swimlane expanded flag but expects data-expanded=\"false\" in the rendered HTML. Update either the constructor argument to false or the expected HTML to data-expanded=\"true\" so the test assertion matches the intended behavior.
| var expected = @"<div class=""wx-webui-kanban""><div id=""a"" class=""wx-swimlane"" data-label=""A"" data-expanded=""false""></div></div>"; | |
| var expected = @"<div class=""wx-webui-kanban""><div id=""a"" class=""wx-swimlane"" data-label=""A"" data-expanded=""true""></div></div>"; |
| |Attribute |Description | ||
| |---------------------------------------------------------|--------------------------------------------------------------------- | ||
| |`id` |A unique ID for the node, used for events and programmatic control. | ||
| |`data-label` |The visible text of the node. | ||
| |`data-icon` |A base icon used for both the opened and closed states. | ||
| |`data-icon-opened` |A specific icon for the expanded state. | ||
| |`data-icon-closed` |A specific icon for the collapsed state. | ||
| |`data-image` / `data-image-opened` / `data-image-closed` |Corresponds to the icon attributes, but for using image URLs. | ||
| |`data-active` |If set to `"true"`, the node is marked as active (e.g., highlighted). | ||
| |`data-expand` |If set to `"true"`, the node is initially displayed in an expanded state. | ||
| |`data-uri` / `data-target` |Creates a link (`<a>`) instead of a button to point to a URL. | ||
| |`data-tooltip` |Adds a tooltip to the node. |
There was a problem hiding this comment.
The attribute table formatting is non-standard Markdown (missing leading/trailing pipes per row and typical header separator formatting), and may not render as a table across Markdown renderers. Consider rewriting it using canonical table syntax (single | separators with a header row and | --- | --- | separator) to ensure consistent rendering.
| |Attribute |Description | |
| |---------------------------------------------------------|--------------------------------------------------------------------- | |
| |`id` |A unique ID for the node, used for events and programmatic control. | |
| |`data-label` |The visible text of the node. | |
| |`data-icon` |A base icon used for both the opened and closed states. | |
| |`data-icon-opened` |A specific icon for the expanded state. | |
| |`data-icon-closed` |A specific icon for the collapsed state. | |
| |`data-image` / `data-image-opened` / `data-image-closed` |Corresponds to the icon attributes, but for using image URLs. | |
| |`data-active` |If set to `"true"`, the node is marked as active (e.g., highlighted). | |
| |`data-expand` |If set to `"true"`, the node is initially displayed in an expanded state. | |
| |`data-uri` / `data-target` |Creates a link (`<a>`) instead of a button to point to a URL. | |
| |`data-tooltip` |Adds a tooltip to the node. | |
| | Attribute | Description | | |
| | ------------------------------------------------------- | ------------------------------------------------------------------- | | |
| | `id` | A unique ID for the node, used for events and programmatic control.| | |
| | `data-label` | The visible text of the node. | | |
| | `data-icon` | A base icon used for both the opened and closed states. | | |
| | `data-icon-opened` | A specific icon for the expanded state. | | |
| | `data-icon-closed` | A specific icon for the collapsed state. | | |
| | `data-image` / `data-image-opened` / `data-image-closed`| Corresponds to the icon attributes, but for using image URLs. | | |
| | `data-active` | If set to `"true"`, the node is marked as active (e.g., highlighted).| | |
| | `data-expand` | If set to `"true"`, the node is initially displayed in an expanded state.| | |
| | `data-uri` / `data-target` | Creates a link (`<a>`) instead of a button to point to a URL. | | |
| | `data-tooltip` | Adds a tooltip to the node. | |
| /// <param name="uri">The URI of the request.</param> | ||
| /// <returns>A fake request for testing.</returns> | ||
| public static Request CrerateRequestMock(string content = "", string uri = "") | ||
| public static IRequest CrerateRequestMock(string content = "", string uri = "") |
There was a problem hiding this comment.
The method name CrerateRequestMock appears to be misspelled (likely intended CreateRequestMock). Since this is a test fixture API, consider introducing a correctly named method and (optionally) keeping the old one as an [Obsolete] wrapper to avoid a large rename churn and improve readability.
| [InlineData(null, @"<button class=""list-group-item-action""></button>")] | ||
| [InlineData("modal", @"<button class=""list-group-item-action"" data-wx-primary-action=""modal"" data-wx-primary-target=""#modal""></button>")] | ||
| public void PrimaryAction(string modal, string expected) | ||
| { | ||
| // arrange | ||
| var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); | ||
| var context = UnitTestControlFixture.CreateRenderContextMock(); | ||
| var visualTree = new VisualTreeControl(componentHub, context.PageContext); | ||
| var control = new ControlListItemButton() | ||
| { | ||
| PrimaryAction = new ActionModal(modal) | ||
| }; |
There was a problem hiding this comment.
For the null test case, the setup still constructs new ActionModal(modal) (with modal == null) while the expected HTML asserts no primary-action attributes. If ActionModal doesn't treat null as 'no action' (or throws), this test will fail. Set PrimaryAction to null when modal is null/empty/whitespace so the setup matches the expectation.
…ng, and Markdown formatting Agent-Logs-Url: https://github.com/webexpress-framework/WebExpress.WebUI/sessions/1636dcff-9fa7-4a2f-ae04-5aa71e2ee9a1 Co-authored-by: ReneSchwarzer <31061438+ReneSchwarzer@users.noreply.github.com>
…pendencies Fix review feedback from PR #6: swimlane semantics, typo, null handling, Markdown table
Agent-Logs-Url: https://github.com/webexpress-framework/WebExpress.WebUI/sessions/ce78eb3a-54b0-4482-a0e9-b1bc2923930f Co-authored-by: ReneSchwarzer <31061438+ReneSchwarzer@users.noreply.github.com>
…ress-webui-documentation Add UnitTestDeterministicId test class to WebUI test suite
This pull request introduces several improvements and additions to the test suite, focusing on code clarity, null handling, and new test coverage. The main changes include the addition of a new unit test class for deterministic identifiers, improved null handling in assertion helpers, and consistent naming and structure updates in test methods.