@@ -228,74 +228,6 @@ describe('ListView', function () {
228
228
} ) ;
229
229
} ) ;
230
230
231
- it ( 'should allow drag and drop of a single row, selectionMode="none"' , async function ( ) {
232
- let { getAllByRole, getByText} = render (
233
- < DraggableListView listViewProps = { { selectionMode : 'none' } } />
234
- ) ;
235
-
236
- let droppable = getByText ( 'Drop here' ) ;
237
- let row = getAllByRole ( 'row' ) [ 0 ] ;
238
- expect ( row ) . toHaveAttribute ( 'draggable' , 'true' ) ;
239
- let cell = within ( row ) . getByRole ( 'gridcell' ) ;
240
- expect ( cell ) . toHaveTextContent ( 'Adobe Photoshop' ) ;
241
-
242
- let dataTransfer = new DataTransfer ( ) ;
243
- fireEvent . pointerDown ( cell , { pointerType : 'mouse' , button : 0 , pointerId : 1 , clientX : 0 , clientY : 0 } ) ;
244
- fireEvent ( cell , new DragEvent ( 'dragstart' , { dataTransfer, clientX : 0 , clientY : 0 } ) ) ;
245
- expect ( [ ...dataTransfer . items ] ) . toEqual ( [ new DataTransferItem ( 'text/plain' , 'Adobe Photoshop' ) ] ) ;
246
-
247
- act ( ( ) => jest . runAllTimers ( ) ) ;
248
-
249
- expect ( onDragStart ) . toHaveBeenCalledTimes ( 1 ) ;
250
- expect ( onDragStart ) . toHaveBeenCalledWith ( {
251
- type : 'dragstart' ,
252
- keys : new Set ( 'a' ) ,
253
- x : 0 ,
254
- y : 0
255
- } ) ;
256
-
257
- fireEvent . pointerMove ( cell , { pointerType : 'mouse' , button : 0 , pointerId : 1 , clientX : 1 , clientY : 1 } ) ;
258
- fireEvent ( cell , new DragEvent ( 'drag' , { dataTransfer, clientX : 1 , clientY : 1 } ) ) ;
259
- expect ( onDragMove ) . toHaveBeenCalledTimes ( 1 ) ;
260
- expect ( onDragMove ) . toHaveBeenCalledWith ( {
261
- type : 'dragmove' ,
262
- keys : new Set ( 'a' ) ,
263
- x : 1 ,
264
- y : 1
265
- } ) ;
266
-
267
- fireEvent ( droppable , new DragEvent ( 'dragenter' , { dataTransfer, clientX : 1 , clientY : 1 } ) ) ;
268
- fireEvent . pointerUp ( cell , { pointerType : 'mouse' , button : 0 , pointerId : 1 , clientX : 1 , clientY : 1 } ) ;
269
- fireEvent ( droppable , new DragEvent ( 'drop' , { dataTransfer, clientX : 1 , clientY : 1 } ) ) ;
270
- fireEvent ( cell , new DragEvent ( 'dragend' , { dataTransfer, clientX : 1 , clientY : 1 } ) ) ;
271
- act ( ( ) => jest . runAllTimers ( ) ) ;
272
- expect ( onDrop ) . toHaveBeenCalledTimes ( 1 ) ;
273
- expect ( onDrop ) . toHaveBeenCalledWith ( {
274
- type : 'drop' ,
275
- x : 1 ,
276
- y : 1 ,
277
- dropOperation : 'move' ,
278
- items : [
279
- {
280
- kind : 'text' ,
281
- types : new Set ( [ 'text/plain' ] ) ,
282
- getText : expect . any ( Function )
283
- }
284
- ]
285
- } ) ;
286
-
287
- expect ( await onDrop . mock . calls [ 0 ] [ 0 ] . items [ 0 ] . getText ( 'text/plain' ) ) . toBe ( 'Adobe Photoshop' ) ;
288
- expect ( onDragEnd ) . toHaveBeenCalledTimes ( 1 ) ;
289
- expect ( onDragEnd ) . toHaveBeenCalledWith ( {
290
- type : 'dragend' ,
291
- keys : new Set ( 'a' ) ,
292
- x : 1 ,
293
- y : 1 ,
294
- dropOperation : 'move' ,
295
- isInternal : false
296
- } ) ;
297
- } ) ;
298
-
299
231
it ( 'should allow drag and drop of multiple rows' , async function ( ) {
300
232
let { getAllByRole, getByText} = render (
301
233
< DraggableListView />
@@ -1830,52 +1762,6 @@ describe('ListView', function () {
1830
1762
} ) ;
1831
1763
} ) ;
1832
1764
1833
- it ( 'should allow drag and drop of a single row, selectionMode="none"' , async function ( ) {
1834
- let { getAllByRole, getByText} = render (
1835
- < DraggableListView listViewProps = { { selectionMode : 'none' } } />
1836
- ) ;
1837
-
1838
- let droppable = getByText ( 'Drop here' ) ;
1839
- let row = getAllByRole ( 'row' ) [ 0 ] ;
1840
- let cell = within ( row ) . getByRole ( 'gridcell' ) ;
1841
- expect ( cell ) . toHaveTextContent ( 'Adobe Photoshop' ) ;
1842
- expect ( row ) . toHaveAttribute ( 'draggable' , 'true' ) ;
1843
-
1844
- userEvent . tab ( ) ;
1845
- let draghandle = within ( cell ) . getAllByRole ( 'button' ) [ 0 ] ;
1846
- expect ( draghandle ) . toBeTruthy ( ) ;
1847
- expect ( draghandle ) . toHaveAttribute ( 'draggable' , 'true' ) ;
1848
-
1849
- fireEvent . keyDown ( draghandle , { key : 'Enter' } ) ;
1850
- fireEvent . keyUp ( draghandle , { key : 'Enter' } ) ;
1851
-
1852
- expect ( onDragStart ) . toHaveBeenCalledTimes ( 1 ) ;
1853
- expect ( onDragStart ) . toHaveBeenCalledWith ( {
1854
- type : 'dragstart' ,
1855
- keys : new Set ( 'a' ) ,
1856
- x : 50 ,
1857
- y : 25
1858
- } ) ;
1859
-
1860
- act ( ( ) => jest . runAllTimers ( ) ) ;
1861
- expect ( document . activeElement ) . toBe ( droppable ) ;
1862
- fireEvent . keyDown ( droppable , { key : 'Enter' } ) ;
1863
- fireEvent . keyUp ( droppable , { key : 'Enter' } ) ;
1864
-
1865
- expect ( onDrop ) . toHaveBeenCalledTimes ( 1 ) ;
1866
- expect ( await onDrop . mock . calls [ 0 ] [ 0 ] . items [ 0 ] . getText ( 'text/plain' ) ) . toBe ( 'Adobe Photoshop' ) ;
1867
-
1868
- expect ( onDragEnd ) . toHaveBeenCalledTimes ( 1 ) ;
1869
- expect ( onDragEnd ) . toHaveBeenCalledWith ( {
1870
- type : 'dragend' ,
1871
- keys : new Set ( 'a' ) ,
1872
- x : 50 ,
1873
- y : 25 ,
1874
- dropOperation : 'move' ,
1875
- isInternal : false
1876
- } ) ;
1877
- } ) ;
1878
-
1879
1765
it ( 'should allow drag and drop of multiple rows' , async function ( ) {
1880
1766
let { getAllByRole, getByText} = render (
1881
1767
< DraggableListView listViewProps = { { selectedKeys : [ 'a' , 'b' , 'c' , 'd' ] } } />
0 commit comments