test: finish TODO for escape key hack

Fix was merged upstream so we can remove the hack.
This commit is contained in:
David Lechner
2022-11-22 15:56:56 -06:00
committed by David Lechner
parent 9fe62467d5
commit bb8015eae5
4 changed files with 9 additions and 39 deletions
+1 -9
View File
@@ -137,15 +137,7 @@ describe('Editor', () => {
expect(editor.getByRole('menuitem', { name: 'Copy' })).toHaveFocus(),
);
// FIXME: use userEvent instead of fireEvent
// blocked by https://github.com/palantir/blueprint/pull/5349
// await user.keyboard('{Escape}');
user;
fireEvent.keyDown(document.activeElement ?? document, {
key: 'Escape',
keyCode: 27,
which: 27,
});
await user.keyboard('{Escape}');
await waitFor(() => expect(contextMenu).not.toBeInTheDocument());
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2022 The Pybricks Authors
import { cleanup, fireEvent, waitFor } from '@testing-library/react';
import { cleanup, waitFor } from '@testing-library/react';
import React from 'react';
import { testRender } from '../../../test';
import DeleteFileAlert from './DeleteFileAlert';
@@ -54,15 +54,8 @@ describe('cancel', () => {
await waitFor(() =>
expect(dialog.getByRole('button', { name: 'Delete' })).toHaveFocus(),
);
// FIXME: use userEvent instead of fireEvent
// blocked by https://github.com/palantir/blueprint/pull/5349
// await user.keyboard('{Escape}');
user;
fireEvent.keyDown(document.activeElement ?? document, {
key: 'Escape',
keyCode: 27,
which: 27,
});
await user.keyboard('{Escape}');
expect(dispatch).toHaveBeenCalledWith(deleteFileAlertDidCancel());
});
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2022 The Pybricks Authors
import { fireEvent, waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/dom';
import React from 'react';
import { testRender } from '../../../test';
import DuplicateFileDialog from './DuplicateFileDialog';
@@ -71,15 +71,8 @@ describe('duplicate button', () => {
await waitFor(() =>
expect(dialog.getByRole('textbox', { name: 'File name' })).toHaveFocus(),
);
// FIXME: use userEvent instead of fireEvent
// blocked by https://github.com/palantir/blueprint/pull/5349
// await user.keyboard('{Escape}');
user;
fireEvent.keyDown(document.activeElement ?? document, {
key: 'Escape',
keyCode: 27,
which: 27,
});
await user.keyboard('{Escape}');
expect(dispatch).toHaveBeenCalledWith(duplicateFileDialogDidCancel());
});
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2022 The Pybricks Authors
import { fireEvent, waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/dom';
import { cleanup } from '@testing-library/react';
import React from 'react';
import { testRender } from '../../../test';
@@ -67,15 +67,7 @@ describe('cancel', () => {
expect(dialog.getByRole('textbox', { name: 'File name' })).toHaveFocus(),
);
// FIXME: use userEvent instead of fireEvent
// blocked by https://github.com/palantir/blueprint/pull/5349
// await user.keyboard('{Escape}');
user;
fireEvent.keyDown(document.activeElement ?? document, {
key: 'Escape',
keyCode: 27,
which: 27,
});
await user.keyboard('{Escape}');
expect(dispatch).toHaveBeenCalledWith(newFileWizardDidCancel());
});