@@ -15,6 +15,7 @@ describe("robot with default event target", () => {
15
15
16
16
afterEach ( ( ) => {
17
17
jest . clearAllTimers ( ) ;
18
+ jest . clearAllMocks ( ) ;
18
19
} ) ;
19
20
20
21
describe ( "with mouse events" , ( ) => {
@@ -233,6 +234,34 @@ describe("robot with default event target", () => {
233
234
div2 . addEventListener ( "touchmove" , handler2 ) ;
234
235
} ) ;
235
236
237
+ test ( "on touchend, the touch is removed from the cache" , ( ) => {
238
+ robot
239
+ . touchmove ( { } , [
240
+ { "identifier" : 1 , "screenX" : 16 , "screenY" : 130 , "clientX" : 140 , "clientY" : 241 , "force" : 18 , "pageX" : 1 ,
241
+ "pageY" : 5 , "radiusX" : 420 , "radiusY" : 540 , "rotationAngle" : 64 , "altitudeAngle" : 112 , "azimuthAngle" : 123 }
242
+ ] )
243
+ . touchmove ( { } , [
244
+ { "identifier" : 2 , "screenX" : 16 , "screenY" : 130 , "clientX" : 140 , "clientY" : 241 , "force" : 18 , "pageX" : 1 ,
245
+ "pageY" : 5 , "radiusX" : 420 , "radiusY" : 540 , "rotationAngle" : 64 , "altitudeAngle" : 112 , "azimuthAngle" : 123 }
246
+ ] )
247
+ . touchend ( { } , [
248
+ { "identifier" : 1 , "screenX" : 16 , "screenY" : 130 , "clientX" : 140 , "clientY" : 241 , "force" : 18 , "pageX" : 1 ,
249
+ "pageY" : 5 , "radiusX" : 420 , "radiusY" : 540 , "rotationAngle" : 64 , "altitudeAngle" : 112 , "azimuthAngle" : 123 }
250
+ ] )
251
+ . touchmove ( { } , [
252
+ { "identifier" : 2 , "screenX" : 17 , "screenY" : 130 , "clientX" : 140 , "clientY" : 241 , "force" : 18 , "pageX" : 1 ,
253
+ "pageY" : 5 , "radiusX" : 420 , "radiusY" : 540 , "rotationAngle" : 64 , "altitudeAngle" : 112 , "azimuthAngle" : 123 }
254
+ ] ) ;
255
+
256
+ expect ( handler ) . toHaveBeenNthCalledWith ( 3 , expect . objectContaining ( {
257
+ "targetTouches" : [
258
+ { "identifier" : 2 , "screenX" : 17 , "screenY" : 130 , "clientX" : 140 , "clientY" : 241 , "force" : 18 , "pageX" : 1 ,
259
+ "pageY" : 5 , "radiusX" : 420 , "radiusY" : 540 , "rotationAngle" : 64 , "altitudeAngle" : 112 , "azimuthAngle" : 123 ,
260
+ "target" : div , "touchType" : "direct" }
261
+ ]
262
+ } ) ) ;
263
+ } ) ;
264
+
236
265
test ( "targetTouches and touches attribute filled after several touch events" , ( ) => {
237
266
robot
238
267
. touchmove ( { } , [
0 commit comments