@@ -68,9 +68,9 @@ describe('DragDropRegistry', () => {
6868 const subscription = registry . pointerMove . subscribe ( spy ) ;
6969
7070 registry . startDragging ( testComponent . dragItems . first , createMouseEvent ( 'mousedown' ) ) ;
71- dispatchMouseEvent ( document , 'mousemove' ) ;
71+ const event = dispatchMouseEvent ( document , 'mousemove' ) ;
7272
73- expect ( spy ) . toHaveBeenCalled ( ) ;
73+ expect ( spy ) . toHaveBeenCalledWith ( event ) ;
7474
7575 subscription . unsubscribe ( ) ;
7676 } ) ;
@@ -81,9 +81,9 @@ describe('DragDropRegistry', () => {
8181
8282 registry . startDragging ( testComponent . dragItems . first ,
8383 createTouchEvent ( 'touchstart' ) as TouchEvent ) ;
84- dispatchTouchEvent ( document , 'touchmove' ) ;
84+ const event = dispatchTouchEvent ( document , 'touchmove' ) ;
8585
86- expect ( spy ) . toHaveBeenCalled ( ) ;
86+ expect ( spy ) . toHaveBeenCalledWith ( event ) ;
8787
8888 subscription . unsubscribe ( ) ;
8989 } ) ;
@@ -106,9 +106,9 @@ describe('DragDropRegistry', () => {
106106 const subscription = registry . pointerUp . subscribe ( spy ) ;
107107
108108 registry . startDragging ( testComponent . dragItems . first , createMouseEvent ( 'mousedown' ) ) ;
109- dispatchMouseEvent ( document , 'mouseup' ) ;
109+ const event = dispatchMouseEvent ( document , 'mouseup' ) ;
110110
111- expect ( spy ) . toHaveBeenCalled ( ) ;
111+ expect ( spy ) . toHaveBeenCalledWith ( event ) ;
112112
113113 subscription . unsubscribe ( ) ;
114114 } ) ;
@@ -119,9 +119,22 @@ describe('DragDropRegistry', () => {
119119
120120 registry . startDragging ( testComponent . dragItems . first ,
121121 createTouchEvent ( 'touchstart' ) as TouchEvent ) ;
122- dispatchTouchEvent ( document , 'touchend' ) ;
122+ const event = dispatchTouchEvent ( document , 'touchend' ) ;
123123
124- expect ( spy ) . toHaveBeenCalled ( ) ;
124+ expect ( spy ) . toHaveBeenCalledWith ( event ) ;
125+
126+ subscription . unsubscribe ( ) ;
127+ } ) ;
128+
129+ it ( 'should dispatch `touchcancel` events if the drag was interrupted' , ( ) => {
130+ const spy = jasmine . createSpy ( 'pointerUp spy' ) ;
131+ const subscription = registry . pointerUp . subscribe ( spy ) ;
132+
133+ registry . startDragging ( testComponent . dragItems . first ,
134+ createTouchEvent ( 'touchstart' ) as TouchEvent ) ;
135+ const event = dispatchTouchEvent ( document , 'touchcancel' ) ;
136+
137+ expect ( spy ) . toHaveBeenCalledWith ( event ) ;
125138
126139 subscription . unsubscribe ( ) ;
127140 } ) ;
0 commit comments