MCPcopy Create free account
hub / github.com/dailydotdev/apps / firePointer

Function firePointer

packages/shared/src/components/shell/ShellCluster.spec.tsx:43–53  ·  view source on GitHub ↗
(
  type: string,
  element: Element,
  clientX: number,
  pointerType = 'touch',
)

Source from the content-addressed store, hash-verified

41// jsdom has no PointerEvent; a MouseEvent with the pointer fields set is
42// what React's pointer handlers read.
43const 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
55const mockTrackRect = () =>
56 jest.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockReturnValue({

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected