@@ -68,9 +68,9 @@ describe('DragDropRegistry', () => {
68
68
const subscription = registry . pointerMove . subscribe ( spy ) ;
69
69
70
70
registry . startDragging ( testComponent . dragItems . first , createMouseEvent ( 'mousedown' ) ) ;
71
- dispatchMouseEvent ( document , 'mousemove' ) ;
71
+ const event = dispatchMouseEvent ( document , 'mousemove' ) ;
72
72
73
- expect ( spy ) . toHaveBeenCalled ( ) ;
73
+ expect ( spy ) . toHaveBeenCalledWith ( event ) ;
74
74
75
75
subscription . unsubscribe ( ) ;
76
76
} ) ;
@@ -81,9 +81,9 @@ describe('DragDropRegistry', () => {
81
81
82
82
registry . startDragging ( testComponent . dragItems . first ,
83
83
createTouchEvent ( 'touchstart' ) as TouchEvent ) ;
84
- dispatchTouchEvent ( document , 'touchmove' ) ;
84
+ const event = dispatchTouchEvent ( document , 'touchmove' ) ;
85
85
86
- expect ( spy ) . toHaveBeenCalled ( ) ;
86
+ expect ( spy ) . toHaveBeenCalledWith ( event ) ;
87
87
88
88
subscription . unsubscribe ( ) ;
89
89
} ) ;
@@ -106,9 +106,9 @@ describe('DragDropRegistry', () => {
106
106
const subscription = registry . pointerUp . subscribe ( spy ) ;
107
107
108
108
registry . startDragging ( testComponent . dragItems . first , createMouseEvent ( 'mousedown' ) ) ;
109
- dispatchMouseEvent ( document , 'mouseup' ) ;
109
+ const event = dispatchMouseEvent ( document , 'mouseup' ) ;
110
110
111
- expect ( spy ) . toHaveBeenCalled ( ) ;
111
+ expect ( spy ) . toHaveBeenCalledWith ( event ) ;
112
112
113
113
subscription . unsubscribe ( ) ;
114
114
} ) ;
@@ -119,9 +119,22 @@ describe('DragDropRegistry', () => {
119
119
120
120
registry . startDragging ( testComponent . dragItems . first ,
121
121
createTouchEvent ( 'touchstart' ) as TouchEvent ) ;
122
- dispatchTouchEvent ( document , 'touchend' ) ;
122
+ const event = dispatchTouchEvent ( document , 'touchend' ) ;
123
123
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 ) ;
125
138
126
139
subscription . unsubscribe ( ) ;
127
140
} ) ;
0 commit comments