| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 suite('drag and drop', function() { | 5 suite('drag and drop', function() { |
| 6 var app; | 6 var app; |
| 7 var list; | 7 var list; |
| 8 var sidebar; | 8 var sidebar; |
| 9 var store; | 9 var store; |
| 10 var dndManager; | 10 var dndManager; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 DropPosition.ON | DropPosition.ABOVE, | 226 DropPosition.ON | DropPosition.ABOVE, |
| 227 dndManager.calculateValidDropPositions_(dragTarget)); | 227 dndManager.calculateValidDropPositions_(dragTarget)); |
| 228 | 228 |
| 229 dispatchDragEvent('dragover', dragTarget); | 229 dispatchDragEvent('dragover', dragTarget); |
| 230 | 230 |
| 231 assertDragStyle(dragTarget, DRAG_STYLE.ON); | 231 assertDragStyle(dragTarget, DRAG_STYLE.ON); |
| 232 | 232 |
| 233 dispatchDragEvent('dragend', dragElement); | 233 dispatchDragEvent('dragend', dragElement); |
| 234 assertDragStyle(dragTarget, DRAG_STYLE.NONE); | 234 assertDragStyle(dragTarget, DRAG_STYLE.NONE); |
| 235 | 235 |
| 236 store.data.closedFolders['11'] = true; | 236 store.data.closedFolders.add('11'); |
| 237 | 237 |
| 238 dispatchDragEvent('dragstart', dragElement); | 238 dispatchDragEvent('dragstart', dragElement); |
| 239 dndManager.dragInfo_.handleChromeDragEnter(createDragData(draggedIds)); | 239 dndManager.dragInfo_.handleChromeDragEnter(createDragData(draggedIds)); |
| 240 | 240 |
| 241 // Drags below a closed folder are allowed. | 241 // Drags below a closed folder are allowed. |
| 242 assertEquals( | 242 assertEquals( |
| 243 DropPosition.ON | DropPosition.ABOVE | DropPosition.BELOW, | 243 DropPosition.ON | DropPosition.ABOVE | DropPosition.BELOW, |
| 244 dndManager.calculateValidDropPositions_(dragTarget)); | 244 dndManager.calculateValidDropPositions_(dragTarget)); |
| 245 }); | 245 }); |
| 246 | 246 |
| 247 test('drag multiple list items', function() { | 247 test('drag multiple list items', function() { |
| 248 // Dragging multiple items. | 248 // Dragging multiple items. |
| 249 store.data.selection.items = {'13': true, '15': true}; | 249 store.data.selection.items = new Set(['13', '15']); |
| 250 dispatchDragEvent('dragstart', getListItem('13')); | 250 dispatchDragEvent('dragstart', getListItem('13')); |
| 251 assertDeepEquals(['13', '15'], draggedIds); | 251 assertDeepEquals(['13', '15'], draggedIds); |
| 252 dndManager.dragInfo_.handleChromeDragEnter(createDragData(draggedIds)); | 252 dndManager.dragInfo_.handleChromeDragEnter(createDragData(draggedIds)); |
| 253 | 253 |
| 254 // The dragged items should not be allowed to be dragged around any selected | 254 // The dragged items should not be allowed to be dragged around any selected |
| 255 // item. | 255 // item. |
| 256 assertEquals( | 256 assertEquals( |
| 257 DropPosition.NONE, | 257 DropPosition.NONE, |
| 258 dndManager.calculateValidDropPositions_(getListItem('13'))); | 258 dndManager.calculateValidDropPositions_(getListItem('13'))); |
| 259 assertEquals( | 259 assertEquals( |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 assertDragStyle(dragTarget, DRAG_STYLE.ABOVE); | 380 assertDragStyle(dragTarget, DRAG_STYLE.ABOVE); |
| 381 | 381 |
| 382 dispatchDragEvent('drop', dragTarget); | 382 dispatchDragEvent('drop', dragTarget); |
| 383 assertEquals('1', dropParentId); | 383 assertEquals('1', dropParentId); |
| 384 assertEquals(1, dropIndex); | 384 assertEquals(1, dropIndex); |
| 385 | 385 |
| 386 dispatchDragEvent('dragend', dragTarget); | 386 dispatchDragEvent('dragend', dragTarget); |
| 387 assertDragStyle(dragTarget, DRAG_STYLE.NONE); | 387 assertDragStyle(dragTarget, DRAG_STYLE.NONE); |
| 388 }); | 388 }); |
| 389 }); | 389 }); |
| OLD | NEW |