Skip to content

Commit

Permalink
Deprecate fireUserEvent exports
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasTy committed Aug 20, 2024
1 parent c99765e commit 83e9b65
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 26 deletions.
26 changes: 0 additions & 26 deletions test/utils/fireUserEvent.ts

This file was deleted.

30 changes: 30 additions & 0 deletions test/utils/fireUserEvent/fireUserEvent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { fireEvent } from '@mui/internal-test-utils/createRenderer';

/**
* @deprecated Use `pointer` from `@testing-library/user-event` instead.
*/
export function touch(target: Element): void {
fireEvent.touchStart(target);
fireEvent.touchEnd(target);
}

/**
* @param {...any} args The arguments to pass to `fireEvent.mouseDown`, `fireEvent.mouseUp`, and `fireEvent.click`.
* @deprecated Use `click` from `@testing-library/user-event` instead.
*/
export const mousePress: (...args: Parameters<(typeof fireEvent)['mouseUp']>) => void = (
target,
options,
) => {
fireEvent.mouseDown(target, options);
fireEvent.mouseUp(target, options);
fireEvent.click(target, options);
};

/**
* @deprecated Use `keyboard` or `type` from `@testing-library/user-event` instead.
*/
export function keyPress(target: Element, options: { key: string; [key: string]: any }): void {
fireEvent.keyDown(target, options);
fireEvent.keyUp(target, options);
}
1 change: 1 addition & 0 deletions test/utils/fireUserEvent/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * as fireUserEvent from './fireUserEvent';

0 comments on commit 83e9b65

Please sign in to comment.