Skip to content

Commit

Permalink
Components: Refactor Tooltip tests to @testing-library/react (#43061
Browse files Browse the repository at this point in the history
)

* Migrate frim enzyme to testing-library

* update text matcher

* Fix typo

* Update matcher

* Refactor fireEvent to userEvent

* Brush up test (tooltip won't be rendered)

* Refactor setTimeout to findBy in one test

* Don't use getElementsByClassName

* Don't use nodeName, childNodes

* Remove unused event handler

* Remove tootip position props

* Add test: should render children with additional popover when hovered

* Simplify mouse click test

* Standardize test cases name

* Add test to 'should render children'

* Merge two tests for focus

* Refactor 'should render children with additional tooltip when hovered' test without  and

* Rename from `handleClick` to `onClickMock`

* Remove unnecessary test 'should show tooltip on delayed mouseenter'

* Reactor: should not show tooltip on focus as result of mouse click

* Refactor: should respect custom delay prop when showing tooltip

* Refactor: should show tooltip when an element is disabled

* Refactor: should not show tooltip if the mouse leaves the anchor before the tooltip has shown

* Update changelog
  • Loading branch information
t-hamano authored Aug 22, 2022
1 parent 6f94c67 commit 2bc40bb
Show file tree
Hide file tree
Showing 2 changed files with 189 additions and 172 deletions.
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

### Internal

- `Tooltip`: Refactor tests to `@testing-library/react` ([#43061](https://github.com/WordPress/gutenberg/pull/43061)).
- Update `floating-ui` to the latest version ([#43206](https://github.com/WordPress/gutenberg/pull/43206)).
- `DateTimePicker`, `TimePicker`, `DatePicker`: Switch from `moment` to `date-fns` ([#43005](https://github.com/WordPress/gutenberg/pull/43005)).
- `DatePicker`: Switch from `react-dates` to `use-lilius` ([#43005](https://github.com/WordPress/gutenberg/pull/43005)).
Expand Down
Loading

0 comments on commit 2bc40bb

Please sign in to comment.