mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Update dependency @testing-library/user-event to v13 (#40394)
* Update dependency @testing-library/user-event to v13 * Changes needed for userEvent v13 * Ignore pointer-event checks until jsdom issue is fixed * Remove unused act imports Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
This commit is contained in:
@@ -105,7 +105,7 @@ describe('ApiKeysPage', () => {
|
||||
|
||||
setSearchQueryMock.mockClear();
|
||||
expect(screen.getByPlaceholderText(/search keys/i)).toBeInTheDocument();
|
||||
await userEvent.type(screen.getByPlaceholderText(/search keys/i), 'First');
|
||||
userEvent.type(screen.getByPlaceholderText(/search keys/i), 'First');
|
||||
expect(setSearchQueryMock).toHaveBeenCalledTimes(5);
|
||||
});
|
||||
});
|
||||
@@ -125,7 +125,10 @@ describe('ApiKeysPage', () => {
|
||||
expect(within(firstRow).getByRole('cell', { name: /cancel delete/i })).toBeInTheDocument();
|
||||
userEvent.click(within(firstRow).getByRole('cell', { name: /cancel delete/i }));
|
||||
expect(within(firstRow).getByRole('button', { name: /delete$/i })).toBeInTheDocument();
|
||||
userEvent.click(within(firstRow).getByRole('button', { name: /delete$/i }));
|
||||
// TODO remove skipPointerEventsCheck once https://github.com/jsdom/jsdom/issues/3232 is fixed
|
||||
userEvent.click(within(firstRow).getByRole('button', { name: /delete$/i }), undefined, {
|
||||
skipPointerEventsCheck: true,
|
||||
});
|
||||
expect(deleteApiKeyMock).toHaveBeenCalledTimes(1);
|
||||
expect(deleteApiKeyMock).toHaveBeenCalledWith(1, false);
|
||||
|
||||
@@ -135,7 +138,10 @@ describe('ApiKeysPage', () => {
|
||||
expect(within(secondRow).getByRole('cell', { name: /cancel delete/i })).toBeInTheDocument();
|
||||
userEvent.click(within(secondRow).getByRole('cell', { name: /cancel delete/i }));
|
||||
expect(within(secondRow).getByRole('button', { name: /delete$/i })).toBeInTheDocument();
|
||||
userEvent.click(within(secondRow).getByRole('button', { name: /delete$/i }));
|
||||
// TODO remove skipPointerEventsCheck once https://github.com/jsdom/jsdom/issues/3232 is fixed
|
||||
userEvent.click(within(secondRow).getByRole('button', { name: /delete$/i }), undefined, {
|
||||
skipPointerEventsCheck: true,
|
||||
});
|
||||
expect(deleteApiKeyMock).toHaveBeenCalledTimes(1);
|
||||
expect(deleteApiKeyMock).toHaveBeenCalledWith(2, true);
|
||||
});
|
||||
@@ -176,8 +182,8 @@ describe('ApiKeysPage', () => {
|
||||
|
||||
addApiKeyMock.mockClear();
|
||||
userEvent.click(screen.getByRole('button', { name: /add api key/i }));
|
||||
await userEvent.type(screen.getByPlaceholderText(/name/i), 'Test');
|
||||
await userEvent.type(screen.getByPlaceholderText(/1d/i), '60x');
|
||||
userEvent.type(screen.getByPlaceholderText(/name/i), 'Test');
|
||||
userEvent.type(screen.getByPlaceholderText(/1d/i), '60x');
|
||||
expect(screen.queryByText(/not a valid duration/i)).not.toBeInTheDocument();
|
||||
userEvent.click(screen.getByRole('button', { name: /^add$/i }));
|
||||
expect(screen.getByText(/not a valid duration/i)).toBeInTheDocument();
|
||||
@@ -197,8 +203,8 @@ async function addAndVerifyApiKey(addApiKeyMock: jest.Mock, includeExpired: bool
|
||||
expect(screen.getByPlaceholderText(/1d/i)).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: /^add$/i })).toBeInTheDocument();
|
||||
|
||||
await userEvent.type(screen.getByPlaceholderText(/name/i), 'Test');
|
||||
await userEvent.type(screen.getByPlaceholderText(/1d/i), '60s');
|
||||
userEvent.type(screen.getByPlaceholderText(/name/i), 'Test');
|
||||
userEvent.type(screen.getByPlaceholderText(/1d/i), '60s');
|
||||
userEvent.click(screen.getByRole('button', { name: /^add$/i }));
|
||||
expect(addApiKeyMock).toHaveBeenCalledTimes(1);
|
||||
expect(addApiKeyMock).toHaveBeenCalledWith(
|
||||
|
||||
Reference in New Issue
Block a user