Skip to content

Commit

Permalink
Remove the patch for event.code in the SidePanel spec
Browse files Browse the repository at this point in the history
The issue was addressed upstream in react-modal@3.16.1.
  • Loading branch information
Robin Métral committed Oct 24, 2022
1 parent da04a39 commit b31527c
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions packages/circuit-ui/components/SidePanel/SidePanel.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,6 @@ jest.mock('../../util/id', () => ({
uniqueId: () => 'the_one',
}));

/**
* We need to patch the key event because `react-modal` uses the deprecated
* `KeyboardEvent.keyCode`.
* See https://github.com/testing-library/user-event/issues/969
*/
function patchKeyEvent(e: KeyboardEvent) {
Object.defineProperty(e, 'keyCode', {
get: () => (e.code === 'Escape' ? 27 : 0),
});
}
beforeAll(() => {
document.addEventListener('keydown', patchKeyEvent, { capture: true });
});

describe('SidePanel', () => {
const baseProps: SidePanelProps = {
backButtonLabel: 'Back',
Expand Down

0 comments on commit b31527c

Please sign in to comment.