MCPcopy Create free account
hub / github.com/testing-library/user-event / initPointerEvent

Function initPointerEvent

src/event/createEvent.ts:246–274  ·  view source on GitHub ↗
(
  event: PointerEvent,
  {
    pointerId,
    width,
    height,
    pressure,
    tangentialPressure,
    tiltX,
    tiltY,
    twist,
    pointerType,
    isPrimary,
    buttons,
  }: PointerEventInit,
)

Source from the content-addressed store, hash-verified

244}
245
246function initPointerEvent(
247 event: PointerEvent,
248 {
249 pointerId,
250 width,
251 height,
252 pressure,
253 tangentialPressure,
254 tiltX,
255 tiltY,
256 twist,
257 pointerType,
258 isPrimary,
259 buttons,
260 }: PointerEventInit,
261) {
262 assignProps(event, {
263 pointerId: sanitizeNumber(pointerId),
264 width: sanitizeNumber(width ?? 1),
265 height: sanitizeNumber(height ?? 1),
266 pressure: sanitizeNumber(pressure ?? (buttons ? 0.5 : 0)),
267 tangentialPressure: sanitizeNumber(tangentialPressure),
268 tiltX: sanitizeNumber(tiltX),
269 tiltY: sanitizeNumber(tiltY),
270 twist: sanitizeNumber(twist),
271 pointerType: String(pointerType ?? ''),
272 isPrimary: Boolean(isPrimary),
273 })
274}

Callers

nothing calls this directly

Calls 2

assignPropsFunction · 0.85
sanitizeNumberFunction · 0.85

Tested by

no test coverage detected