MCPcopy Index your code
hub / github.com/adobe/react-spectrum / installMouseEvent

Function installMouseEvent

packages/@react-aria/test-utils/src/testSetup.ts:16–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14 * Enables reading pageX/pageY from fireEvent.mouse*(..., {pageX: ..., pageY: ...}).
15 */
16export function installMouseEvent(): void {
17 let oldMouseEvent = MouseEvent;
18 beforeAll(() => {
19 global.MouseEvent = class FakeMouseEvent extends MouseEvent {
20 _init: {pageX: number; pageY: number};
21 constructor(name, init) {
22 super(name, init);
23 this._init = init;
24 }
25 get pageX() {
26 return this._init.pageX;
27 }
28 get pageY() {
29 return this._init.pageY;
30 }
31 };
32 });
33 afterAll(() => {
34 global.MouseEvent = oldMouseEvent;
35 });
36}
37
38export function definePointerEvent(): void {
39 // @ts-ignore

Callers 5

usePress.test.jsFile · 0.85
useMove.test.jsFile · 0.85
useSlider.test.jsFile · 0.85
Slider.test.tsxFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected