Skip to content

enzyme -> RTL: convert the SelectedList component suites - #468

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

enzyme -> RTL: convert the SelectedList component suites#468
cigamit merged 3 commits into
ctrliq:mainfrom
blaipr:feature/rtl-components-selectedlist

Conversation

@blaipr

@blaipr blaipr commented Jun 16, 2026

Copy link
Copy Markdown
Contributor
SUMMARY

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

Files migrated off mountWithContexts/enzyme onto renderWithContexts: SelectedList, DraggableSelectedList.

Chips, the numChips overflow (N more expander), and chip removal are asserted via the rendered DOM and the onRemove callback. The DraggableSelectedList suite stays describe.skip (drag-and-drop has no accessible DOM trigger in jsdom — unchanged from before). Behaviour and assertions are otherwise preserved.

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

npm test for components/SelectedList: 3 passing (+4 pre-existing skips in the drag-and-drop suite). ESLint clean (--no-ignore). No production code changed — test-only.

Migrate components/SelectedList (SelectedList and DraggableSelectedList)
off enzyme/mountWithContexts onto renderWithContexts (React Testing
Library). Chips and overflow are asserted via the rendered DOM; the
pre-existing drag-and-drop describe.skip is preserved. Behaviour and
assertions are otherwise 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

Migrates the SelectedList component test suites from enzyme (mountWithContexts) to React Testing Library (renderWithContexts) as part of the ongoing enzyme → RTL conversion in awx/ui.

Changes:

  • Converted SelectedList tests to assert rendered DOM output (labels, chips, overflow) instead of enzyme prop inspection.
  • Updated chip removal coverage to use userEvent and accessible queries, asserting onRemove callbacks.
  • Converted the (still skipped) DraggableSelectedList suite to RTL queries while preserving the skip status.

Reviewed changes

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

File Description
awx/ui/src/components/SelectedList/SelectedList.test.js Replaces enzyme mounting/prop assertions with RTL DOM assertions, including overflow and removal behaviors.
awx/ui/src/components/SelectedList/DraggableSelectedList.test.js Updates the skipped drag-and-drop suite to RTL patterns and improves inline documentation.

// deprecated. Its replacement is a DragDrop component, however that component
// is not keyboard accessible. Therefore we have elected to turn off these
// tests.
// github.com/patternfly/patternfly-react/issues/6317s
expect(screen.getByText('bar')).toBeInTheDocument();
});

test('showOverflow should set showOverflow on ChipGroup', () => {
});
});

test('should disable remove button when dragging item', () => {
blaipr added 2 commits June 17, 2026 11:07
Fix the PatternFly issue link (add https://, drop the stray trailing s); rename the SelectedList numChips-cap test and the DraggableSelectedList not-dragging test to match what they actually assert.
The suite was skipped only because PatternFly's DataList logs an onDrag deprecation warning on render that the global console trap turns into a failure. Filter just that one warning (forwarding all others) and target the reorder button by data-cy (its accessible name is overridden by aria-labelledby), so the four tests run instead of being skipped.
@blaipr

blaipr commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Pushed a commit: fixed the PatternFly issue link, and renamed the SelectedList numChips test and the DraggableSelectedList not-dragging test to match what they actually assert. I also enabled the DraggableSelectedList suite, which was fully skipped only because PatternFly logs an onDrag deprecation warning on render that the console trap turned into a failure. Filtering just that one warning lets the four tests run and pass.

@cigamit
cigamit merged commit 797cdd8 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