@@ -69,9 +69,9 @@ describe('DragDropRegistry', () => {
6969 const subscription = registry . pointerMove . subscribe ( spy ) ;
7070
7171 registry . startDragging ( testComponent . dragItems . first , createMouseEvent ( 'mousedown' ) ) ;
72- dispatchMouseEvent ( document , 'mousemove' ) ;
72+ const event = dispatchMouseEvent ( document , 'mousemove' ) ;
7373
74- expect ( spy ) . toHaveBeenCalled ( ) ;
74+ expect ( spy ) . toHaveBeenCalledWith ( event ) ;
7575
7676 subscription . unsubscribe ( ) ;
7777 } ) ;
@@ -82,9 +82,9 @@ describe('DragDropRegistry', () => {
8282
8383 registry . startDragging ( testComponent . dragItems . first ,
8484 createTouchEvent ( 'touchstart' ) as TouchEvent ) ;
85- dispatchTouchEvent ( document , 'touchmove' ) ;
85+ const event = dispatchTouchEvent ( document , 'touchmove' ) ;
8686
87- expect ( spy ) . toHaveBeenCalled ( ) ;
87+ expect ( spy ) . toHaveBeenCalledWith ( event ) ;
8888
8989 subscription . unsubscribe ( ) ;
9090 } ) ;
@@ -107,9 +107,9 @@ describe('DragDropRegistry', () => {
107107 const subscription = registry . pointerUp . subscribe ( spy ) ;
108108
109109 registry . startDragging ( testComponent . dragItems . first , createMouseEvent ( 'mousedown' ) ) ;
110- dispatchMouseEvent ( document , 'mouseup' ) ;
110+ const event = dispatchMouseEvent ( document , 'mouseup' ) ;
111111
112- expect ( spy ) . toHaveBeenCalled ( ) ;
112+ expect ( spy ) . toHaveBeenCalledWith ( event ) ;
113113
114114 subscription . unsubscribe ( ) ;
115115 } ) ;
@@ -120,9 +120,22 @@ describe('DragDropRegistry', () => {
120120
121121 registry . startDragging ( testComponent . dragItems . first ,
122122 createTouchEvent ( 'touchstart' ) as TouchEvent ) ;
123- dispatchTouchEvent ( document , 'touchend' ) ;
123+ const event = dispatchTouchEvent ( document , 'touchend' ) ;
124124
125- expect ( spy ) . toHaveBeenCalled ( ) ;
125+ expect ( spy ) . toHaveBeenCalledWith ( event ) ;
126+
127+ subscription . unsubscribe ( ) ;
128+ } ) ;
129+
130+ it ( 'should dispatch `touchcancel` events if the drag was interrupted' , ( ) => {
131+ const spy = jasmine . createSpy ( 'pointerUp spy' ) ;
132+ const subscription = registry . pointerUp . subscribe ( spy ) ;
133+
134+ registry . startDragging ( testComponent . dragItems . first ,
135+ createTouchEvent ( 'touchstart' ) as TouchEvent ) ;
136+ const event = dispatchTouchEvent ( document , 'touchcancel' ) ;
137+
138+ expect ( spy ) . toHaveBeenCalledWith ( event ) ;
126139
127140 subscription . unsubscribe ( ) ;
128141 } ) ;
0 commit comments