From 66c510cde663609c42f6fe393852c02355dfb45b Mon Sep 17 00:00:00 2001 From: Braden MacDonald Date: Thu, 16 Jan 2025 11:21:08 -0800 Subject: [PATCH] test: update test cases (@testing-library/react bumped from v12 to v16) --- src/Breadcrumb/Breadcrumb.test.jsx | 5 +- src/Button/deprecated/Button.test.jsx | 10 +- .../tests/CardCarouselControls.test.jsx | 10 +- src/Collapsible/Collapsible.test.jsx | 22 ++- src/ColorPicker/ColorPicker.test.jsx | 25 ++-- .../tests/ControlledSelectHeader.test.jsx | 10 +- src/DataTable/tests/BulkActions.test.jsx | 4 +- src/DataTable/tests/DataViewToggle.test.jsx | 10 +- src/DataTable/tests/utils.js | 9 -- src/Dropdown/deprecated/Dropdown.test.jsx | 70 +++++---- .../__snapshots__/Dropzone.test.jsx.snap | 11 +- src/Form/tests/FormAutosuggest.test.jsx | 133 ++++++++++-------- src/Form/tests/FormCheckboxSet.test.jsx | 5 +- src/Form/tests/FormControl.test.jsx | 15 +- src/Form/tests/FormRadioSet.test.jsx | 5 +- .../IconButtonToggle.test.jsx | 5 +- src/ListBox/ListBox.test.jsx | 12 +- src/Menu/Menu.test.jsx | 25 ++-- src/Modal/tests/ModalLayer.test.tsx | 5 +- .../data/tests/useOverflowScroll.test.jsx | 3 +- .../tests/useOverflowScrollActions.test.jsx | 2 +- ...seOverflowScrollElementAttributes.test.jsx | 2 +- .../useOverflowScrollEventListeners.test.jsx | 3 +- src/Pagination/Pagination.test.jsx | 64 +++++---- src/ProductTour/Checkpoint.test.jsx | 5 +- src/ProductTour/ProductTour.test.jsx | 35 ++--- src/ProductTour/index.jsx | 2 +- .../tests/SelectableBox.test.jsx | 5 +- src/StatusAlert/StatusAlert.test.jsx | 8 +- src/Tabs/deprecated/Tabs.test.jsx | 10 +- 30 files changed, 292 insertions(+), 238 deletions(-) delete mode 100644 src/DataTable/tests/utils.js diff --git a/src/Breadcrumb/Breadcrumb.test.jsx b/src/Breadcrumb/Breadcrumb.test.jsx index 2b8c93b8f8..3b402d971e 100644 --- a/src/Breadcrumb/Breadcrumb.test.jsx +++ b/src/Breadcrumb/Breadcrumb.test.jsx @@ -48,7 +48,8 @@ describe('', () => { expect(screen.getAllByRole('presentation').length).toBe(2); }); - it('fires the passed in click handler', () => { + it('fires the passed in click handler', async () => { + const user = userEvent.setup(); const clickHandler = jest.fn(); render(); @@ -56,7 +57,7 @@ describe('', () => { const links = screen.queryAllByRole('link'); expect(listItems.length).toBe(baseProps.links.length); - userEvent.click(links[0]); + await user.click(links[0]); expect(clickHandler).toHaveBeenCalled(); }); diff --git a/src/Button/deprecated/Button.test.jsx b/src/Button/deprecated/Button.test.jsx index cb8fa7cfea..1a34c4dcee 100644 --- a/src/Button/deprecated/Button.test.jsx +++ b/src/Button/deprecated/Button.test.jsx @@ -14,21 +14,23 @@ describe('