DevDeps: Bump @testing-library/user-event from 13.5.0 to 14.4.3

This bumps user-event library by a major release and resolves the breaking changes.

Direct invocation of `userEvent` APIs (such as `userEvent.click()`and `userEvent.type()`) was replaced by calling the methods returned by `userEvent.setup()` as described here:
https://testing-library.com/docs/user-event/intro
This commit is contained in:
regexowl 2023-03-20 10:40:22 +01:00 committed by Lucas Garfield
parent 623e0cdc33
commit f92cae1fc2
6 changed files with 180 additions and 160 deletions

View file

@ -164,6 +164,7 @@ let history;
let store;
describe('Create Share To Regions Modal', () => {
const user = userEvent.setup();
test('validation', async () => {
renderWithReduxRouter(<ShareImageModal />, mockState, mockLocation);
@ -177,13 +178,13 @@ describe('Create Share To Regions Modal', () => {
const selectToggle = screen.getByRole('button', { name: /options menu/i });
// eslint-disable-next-line testing-library/no-unnecessary-act
await act(async () => userEvent.click(selectToggle));
await act(async () => user.click(selectToggle));
const usEast2 = screen.getByRole('option', {
name: /us-east-2 us east \(ohio\)/i,
});
expect(usEast2).not.toHaveClass('pf-m-disabled');
userEvent.click(usEast2);
await user.click(usEast2);
expect(shareButton).toBeEnabled();
const clearAllButton = screen.getByRole('button', { name: /clear all/i });
@ -265,13 +266,13 @@ describe('Create Share To Regions Modal', () => {
store = view.store;
const selectToggle = screen.getByRole('button', { name: /options menu/i });
userEvent.click(selectToggle);
await user.click(selectToggle);
const usEast2 = screen.getByRole('option', {
name: /us-east-2 us east \(ohio\)/i,
});
expect(usEast2).not.toHaveClass('pf-m-disabled');
userEvent.click(usEast2);
await user.click(usEast2);
const mockResponse = {
id: '123e4567-e89b-12d3-a456-426655440000',