|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /* |
|
5 * These tests make sure that dragging and dropping sites works as expected. |
|
6 * Sites contained in the grid need to shift around to indicate the result |
|
7 * of the drag-and-drop operation. If the grid is full and we're dragging |
|
8 * a new site into it another one gets pushed out. |
|
9 * This is a continuation of browser_newtab_drag_drop.js |
|
10 * to decrease test run time, focusing on external sites. |
|
11 */ |
|
12 function runTests() { |
|
13 // drag a new site onto the very first cell |
|
14 yield setLinks("0,1,2,3,4,5,6,7,8"); |
|
15 setPinnedLinks(",,,,,,,7,8"); |
|
16 |
|
17 yield addNewTabPageTab(); |
|
18 checkGrid("0,1,2,3,4,5,6,7p,8p"); |
|
19 |
|
20 yield simulateExternalDrop(0); |
|
21 checkGrid("99p,0,1,2,3,4,5,7p,8p"); |
|
22 |
|
23 // drag a new site onto the grid and make sure that pinned cells don't get |
|
24 // pushed out |
|
25 yield setLinks("0,1,2,3,4,5,6,7,8"); |
|
26 setPinnedLinks(",,,,,,,7,8"); |
|
27 |
|
28 yield addNewTabPageTab(); |
|
29 checkGrid("0,1,2,3,4,5,6,7p,8p"); |
|
30 |
|
31 yield simulateExternalDrop(7); |
|
32 checkGrid("0,1,2,3,4,5,7p,99p,8p"); |
|
33 |
|
34 // drag a new site beneath a pinned cell and make sure the pinned cell is |
|
35 // not moved |
|
36 yield setLinks("0,1,2,3,4,5,6,7,8"); |
|
37 setPinnedLinks(",,,,,,,,8"); |
|
38 |
|
39 yield addNewTabPageTab(); |
|
40 checkGrid("0,1,2,3,4,5,6,7,8p"); |
|
41 |
|
42 yield simulateExternalDrop(7); |
|
43 checkGrid("0,1,2,3,4,5,6,99p,8p"); |
|
44 |
|
45 // drag a new site onto a block of pinned sites and make sure they're shifted |
|
46 // around accordingly |
|
47 yield setLinks("0,1,2,3,4,5,6,7,8"); |
|
48 setPinnedLinks("0,1,2,,,,,,"); |
|
49 |
|
50 yield addNewTabPageTab(); |
|
51 checkGrid("0p,1p,2p"); |
|
52 |
|
53 yield simulateExternalDrop(1); |
|
54 checkGrid("0p,99p,1p,2p,3,4,5,6,7"); |
|
55 } |