Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(708)

Side by Side Diff: chrome/test/data/webui/md_bookmarks/dnd_manager_test.js

Issue 2820153003: [MD Bookmarks] Add keyboard navigation to sidebar. (Closed)
Patch Set: fix test Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 rootFolderNode; 8 var rootFolderNode;
9 var store; 9 var store;
10 var dndManager; 10 var dndManager;
11 var draggedIds; 11 var draggedIds;
12 12
13 var DRAG_STYLE = { 13 var DRAG_STYLE = {
14 NONE: 0, 14 NONE: 0,
15 ON: 1, 15 ON: 1,
16 ABOVE: 2, 16 ABOVE: 2,
17 BELOW: 3, 17 BELOW: 3,
18 }; 18 };
19 19
20 function getFolderNode(id) { 20 function getFolderNode(id) {
21 var nodes = [rootFolderNode]; 21 return findFolderNode(rootFolderNode, id);
22 var node;
23 while (nodes.length) {
24 node = nodes.pop();
25 if (node.itemId == id)
26 return node;
27
28 node.root.querySelectorAll('bookmarks-folder-node')
29 .forEach((x) => {nodes.unshift(x)});
30 }
31 } 22 }
32 23
33 function getListItem(id) { 24 function getListItem(id) {
34 var items = list.root.querySelectorAll('bookmarks-item'); 25 var items = list.root.querySelectorAll('bookmarks-item');
35 for (var i = 0; i < items.length; i++) { 26 for (var i = 0; i < items.length; i++) {
36 if (items[i].itemId == id) 27 if (items[i].itemId == id)
37 return items[i]; 28 return items[i];
38 } 29 }
39 } 30 }
40 31
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 465
475 dispatchDragEvent('dragstart', dragElement); 466 dispatchDragEvent('dragstart', dragElement);
476 dndManager.dragInfo_.handleChromeDragEnter(createDragData(draggedIds)); 467 dndManager.dragInfo_.handleChromeDragEnter(createDragData(draggedIds));
477 468
478 dispatchDragEvent('dragover', dragTarget); 469 dispatchDragEvent('dragover', dragTarget);
479 assertEquals( 470 assertEquals(
480 DropPosition.NONE, dndManager.calculateValidDropPositions_(dragTarget)); 471 DropPosition.NONE, dndManager.calculateValidDropPositions_(dragTarget));
481 assertDragStyle(dragTarget, DRAG_STYLE.NONE); 472 assertDragStyle(dragTarget, DRAG_STYLE.NONE);
482 }); 473 });
483 }); 474 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698