@@ -15,6 +15,7 @@ describe("robot with default event target", () => {
1515
1616 afterEach ( ( ) => {
1717 jest . clearAllTimers ( ) ;
18+ jest . clearAllMocks ( ) ;
1819 } ) ;
1920
2021 describe ( "with mouse events" , ( ) => {
@@ -233,6 +234,34 @@ describe("robot with default event target", () => {
233234 div2 . addEventListener ( "touchmove" , handler2 ) ;
234235 } ) ;
235236
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+
236265 test ( "targetTouches and touches attribute filled after several touch events" , ( ) => {
237266 robot
238267 . touchmove ( { } , [
0 commit comments