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

Method release

src/system/pointer/pointer.ts:120–134  ·  view source on GitHub ↗
(instance: Instance)

Source from the content-addressed store, hash-verified

118 }
119
120 release(instance: Instance) {
121 const target = this.getTarget(instance)
122 const [leave] = getTreeDiff(target, null)
123 const init = this.getEventInit()
124
125 // Currently there is no PointerEventsCheckLevel that would
126 // make this check not use the *asserted* cached value from `up`.
127 /* istanbul ignore else */
128 if (hasPointerEvents(instance, target)) {
129 instance.dispatchUIEvent(target, 'pointerout', init)
130 leave.forEach(el => instance.dispatchUIEvent(el, 'pointerleave', init))
131 }
132
133 this.isCancelled = true
134 }
135
136 private getTarget(instance: Instance) {
137 return this.position.target ?? instance.config.document.body

Callers 2

pointerActionFunction · 0.45
pointer.tsFile · 0.45

Calls 4

getTargetMethod · 0.95
getEventInitMethod · 0.95
getTreeDiffFunction · 0.90
hasPointerEventsFunction · 0.90

Tested by

no test coverage detected