| 41 | // jsdom has no PointerEvent; a MouseEvent with the pointer fields set is |
| 42 | // what React's pointer handlers read. |
| 43 | const firePointer = ( |
| 44 | type: string, |
| 45 | element: Element, |
| 46 | clientX: number, |
| 47 | pointerType = 'touch', |
| 48 | ) => { |
| 49 | const event = new MouseEvent(type, { bubbles: true, clientX }); |
| 50 | Object.defineProperty(event, 'pointerId', { value: 1 }); |
| 51 | Object.defineProperty(event, 'pointerType', { value: pointerType }); |
| 52 | fireEvent(element, event); |
| 53 | }; |
| 54 | |
| 55 | const mockTrackRect = () => |
| 56 | jest.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockReturnValue({ |