MCPcopy Index your code
hub / github.com/gridstack/gridstack.js / createMockPointerEvent

Function createMockPointerEvent

spec/dd-touch-spec.ts:72–121  ·  view source on GitHub ↗
(type: string, pointerType: string, options: Partial<PointerEvent> = {})

Source from the content-addressed store, hash-verified

70
71// Helper function to create mock PointerEvent
72function createMockPointerEvent(type: string, pointerType: string, options: Partial<PointerEvent> = {}): PointerEvent {
73 const mockEvent = {
74 pointerId: 1,
75 pointerType,
76 target: document.createElement('div'),
77 preventDefault: vi.fn(),
78 stopPropagation: vi.fn(),
79 cancelable: true,
80 type,
81 currentTarget: document.createElement('div'),
82 bubbles: true,
83 composed: false,
84 defaultPrevented: false,
85 eventPhase: Event.AT_TARGET,
86 isTrusted: true,
87 timeStamp: Date.now(),
88 clientX: 100,
89 clientY: 200,
90 pageX: 100,
91 pageY: 200,
92 screenX: 100,
93 screenY: 200,
94 button: 0,
95 buttons: 1,
96 ctrlKey: false,
97 shiftKey: false,
98 altKey: false,
99 metaKey: false,
100 width: 1,
101 height: 1,
102 pressure: 0.5,
103 tangentialPressure: 0,
104 tiltX: 0,
105 tiltY: 0,
106 twist: 0,
107 isPrimary: true,
108 detail: 0,
109 view: window,
110 which: 0,
111 getCoalescedEvents: vi.fn(() => []),
112 getPredictedEvents: vi.fn(() => []),
113 movementX: 0,
114 movementY: 0,
115 offsetX: 0,
116 offsetY: 0,
117 relatedTarget: null,
118 ...options
119 };
120 return mockEvent as PointerEvent;
121}
122
123describe('dd-touch', () => {
124 let mockUtils: any;

Callers 1

dd-touch-spec.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected