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

Function pointer

src/pointer/index.ts:36–65  ·  view source on GitHub ↗
(
  this: Instance,
  input: PointerInput,
)

Source from the content-addressed store, hash-verified

34}
35
36export async function pointer(
37 this: Instance,
38 input: PointerInput,
39): Promise<void> {
40 const {pointerMap} = this.config
41
42 const actions: PointerAction[] = []
43 ;(Array.isArray(input) ? input : [input]).forEach(actionInput => {
44 if (typeof actionInput === 'string') {
45 actions.push(...parseKeyDef(pointerMap, actionInput))
46 } else if ('keys' in actionInput) {
47 actions.push(
48 ...parseKeyDef(pointerMap, actionInput.keys).map(i => ({
49 ...actionInput,
50 ...i,
51 })),
52 )
53 } else {
54 actions.push(actionInput)
55 }
56 })
57
58 for (let i = 0; i < actions.length; i++) {
59 await wait(this.config)
60
61 await pointerAction(this, actions[i])
62 }
63
64 this.system.pointer.resetClickCount()
65}
66
67async function pointerAction(instance: Instance, action: PointerAction) {
68 const pointerName =

Callers

nothing calls this directly

Calls 4

parseKeyDefFunction · 0.90
waitFunction · 0.90
pointerActionFunction · 0.85
resetClickCountMethod · 0.45

Tested by

no test coverage detected