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

Function getMouseEventOptions

src/utils/click/getMouseEventOptions.ts:59–75  ·  view source on GitHub ↗
(
  event: string,
  init?: MouseEventInit,
  clickCount = 0,
)

Source from the content-addressed store, hash-verified

57}
58
59export function getMouseEventOptions(
60 event: string,
61 init?: MouseEventInit,
62 clickCount = 0,
63) {
64 init = init ?? {}
65 return {
66 ...init,
67 // https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
68 detail:
69 event === 'mousedown' || event === 'mouseup' || event === 'click'
70 ? 1 + clickCount
71 : clickCount,
72 buttons: convertMouseButtons(event, init, 'buttons'),
73 button: convertMouseButtons(event, init, 'button'),
74 }
75}

Callers 6

hoverFunction · 0.90
unhoverFunction · 0.90
clickLabelFunction · 0.90
clickBooleanElementFunction · 0.90
clickElementFunction · 0.90
dblClickFunction · 0.90

Calls 1

convertMouseButtonsFunction · 0.85

Tested by

no test coverage detected