[scanner] fix: update tests for isomorphic-dompurify 3.18.0 compatibility#19412
Conversation
- Update heading component tests to check role and aria-level instead of tagName - Update pagination button tests to check aria-disabled attribute instead of disabled property - Fixes compatibility issues introduced by isomorphic-dompurify 3.18.0 upgrade Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Scanner Bot <scanner@kubestellar.io>
✅ Deploy Preview for kubestellarconsole ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
👋 Hey @clubanderson — thanks for opening this PR!
This is an automated message. |
|
🐝 Hi @clubanderson! I'm Trusted users — org members and contributors with write access — can mention Automation may take a moment to start, and follow-up happens through workflow activity rather than chat replies. |
There was a problem hiding this comment.
Pull request overview
Updates unit tests in the web UI to match the actual rendered accessibility semantics after the isomorphic-dompurify 3.18.0 bump (no production component logic changes).
Changes:
- Adjusts markdown heading component tests to validate
role="heading"andaria-levelinstead of DOM tag names. - Updates pagination “disabled” assertions in list/table visualization tests to check
aria-disabledrather than the.disabledproperty.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| web/src/lib/markdown/tests/releaseNotesComponents.test.tsx | Updates heading assertions to reflect div role="heading" + aria-level output. |
| web/src/lib/unified/card/visualizations/tests/ListVisualization.test.tsx | Updates pagination disabled assertions to use aria-disabled. |
| web/src/lib/unified/card/visualizations/tests/TableVisualization.test.tsx | Updates pagination disabled assertions to use aria-disabled. |
| it('disables prev button on first page', () => { | ||
| renderTable({ pageSize: PAGE_SIZE }) | ||
| const buttons = screen.getAllByRole('button') | ||
| const prevButton = buttons[0] | ||
| expect(prevButton).toHaveProperty('disabled', true) | ||
| expect(prevButton.getAttribute('aria-disabled')).toBe('true') |
| // Refresh buttons reference after re-renders | ||
| const updatedButtons = screen.getAllByRole('button') | ||
| const updatedNext = updatedButtons[updatedButtons.length - 1] | ||
| expect(updatedNext).toHaveProperty('disabled', true) | ||
| expect(updatedNext.getAttribute('aria-disabled')).toBe('true') |
| it('disables prev button on first page', () => { | ||
| renderList({ pageSize: PAGE_SIZE }) | ||
| const buttons = screen.getAllByRole('button') | ||
| const prevButton = buttons[buttons.length - 2] | ||
| expect(prevButton).toHaveProperty('disabled', true) | ||
| expect(prevButton.getAttribute('aria-disabled')).toBe('true') |
| // Re-query buttons after re-render | ||
| const updatedButtons = screen.getAllByRole('button') | ||
| const updatedNext = updatedButtons[updatedButtons.length - 1] | ||
| expect(updatedNext).toHaveProperty('disabled', true) | ||
| expect(updatedNext.getAttribute('aria-disabled')).toBe('true') |
| const { unmount } = render(<Comp>{`heading-${level}`}</Comp>) | ||
| const element = screen.getByText(`heading-${level}`) | ||
| expect(element.getAttribute('role')).toBe('heading') | ||
| expect(element.getAttribute('aria-level')).toBe(String(level)) | ||
| unmount() |
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
✅ Post-Merge Verification: passedCommit: |
|
Post-merge build verification passed ✅ Both Go and frontend builds compiled successfully against merge commit |
Fixes #19408
Updates 5 failing tests to be compatible with the isomorphic-dompurify 3.18.0 bump merged in #19395.
Changes
releaseNotesComponents.test.tsx
role="heading"andaria-levelattributes instead oftagName<div role="heading">elements used in the sourceListVisualization.test.tsx & TableVisualization.test.tsx
aria-disabledattribute instead of.disabledproperty<div role="button">elements used for pagination controlsAll test changes align with the actual component implementations - no source code was changed, only test assertions were corrected.