Skip to content

enzyme -> RTL: convert the PaginatedTable component suites - #458

Merged
cigamit merged 2 commits into
ctrliq:mainfrom
blaipr:feature/rtl-components-paginatedtable
Jun 18, 2026
Merged

enzyme -> RTL: convert the PaginatedTable component suites#458
cigamit merged 2 commits into
ctrliq:mainfrom
blaipr:feature/rtl-components-paginatedtable

Conversation

@blaipr

@blaipr blaipr commented Jun 16, 2026

Copy link
Copy Markdown
Contributor
SUMMARY

Converts the PaginatedTable component test suite (components/PaginatedTable) from enzyme to React Testing Library, continuing the enzyme → RTL migration (components, one directory per PR).

Files migrated off mountWithContexts/enzyme onto renderWithContexts: PaginatedTable, HeaderRow, ActionItem, ToolbarAddButton, ToolbarDeleteButton.

Column sort, pagination (next/prev/per-page), and the delete-confirm flow are driven through the real PF controls and asserted via the resulting history/query string and modal flow (rather than inspecting React props). Behaviour and assertions are preserved.

ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • UI
ADDITIONAL INFORMATION

npm test for components/PaginatedTable: 6 suites, 22 tests, all passing. ESLint clean (--no-ignore). No production code changed — test-only.

Migrate components/PaginatedTable (PaginatedTable, HeaderRow, ActionItem,
ToolbarAddButton, ToolbarDeleteButton) off enzyme/mountWithContexts onto
renderWithContexts (React Testing Library). Sort/pagination/delete are
driven through the real controls and asserted via the resulting history/qs
and confirm flow; behaviour and assertions are preserved.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR continues the enzyme → React Testing Library migration by converting the PaginatedTable component test suites to use renderWithContexts and RTL user interactions, preserving assertions around sorting, pagination, and delete confirmation flows.

Changes:

  • Migrated PaginatedTable-related component tests from enzyme helpers to RTL (renderWithContexts, screen, userEvent).
  • Updated pagination and sorting tests to drive real PatternFly controls and assert via DOM + history/query-string changes.
  • Updated delete-confirm tests to assert modal flows and related-delete-details behavior via accessible queries.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
awx/ui/src/components/PaginatedTable/ToolbarDeleteButton.test.js Converts delete button/confirm flow tests to RTL interactions and modal assertions.
awx/ui/src/components/PaginatedTable/ToolbarAddButton.test.js Converts add button/link tests to RTL using role-based queries and user events.
awx/ui/src/components/PaginatedTable/PaginatedTable.test.js Converts pagination behavior tests to RTL, driving PF pagination controls and asserting history updates.
awx/ui/src/components/PaginatedTable/HeaderRow.test.js Converts header/sort behavior tests to RTL using accessible table queries and click interactions.
awx/ui/src/components/PaginatedTable/ActionItem.test.js Converts ActionItem visibility/tooltip tests to RTL with hover-driven tooltip assertions.

const wrapper = shallow(
test('should render child wrapped with tooltip', async () => {
const { user } = renderWithContexts(
<ActionItem columns={1} tooltip="a tooltip" visible>
test('should render null if not visible', async () => {
const wrapper = shallow(
const { container } = renderWithContexts(
<ActionItem columns={1} tooltip="foo">
Pass the column prop (not columns) so ActionItem is exercised the way ActionsTd injects it.
@blaipr

blaipr commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Pushed a commit: pass the column prop instead of columns so ActionItem is exercised the way ActionsTd injects it.

@cigamit
cigamit merged commit f1a5657 into ctrliq:main Jun 18, 2026
@cigamit cigamit self-assigned this Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants