|
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 blocking/removing sites from the grid works |
|
6 * as expected. Pinned tabs should not be moved. Gaps will be re-filled |
|
7 * if more sites are available. |
|
8 */ |
|
9 function runTests() { |
|
10 // we remove sites and expect the gaps to be filled as long as there still |
|
11 // are some sites available |
|
12 yield setLinks("0,1,2,3,4,5,6,7,8,9"); |
|
13 setPinnedLinks(""); |
|
14 |
|
15 yield addNewTabPageTab(); |
|
16 checkGrid("0,1,2,3,4,5,6,7,8"); |
|
17 |
|
18 yield blockCell(4); |
|
19 checkGrid("0,1,2,3,5,6,7,8,9"); |
|
20 |
|
21 yield blockCell(4); |
|
22 checkGrid("0,1,2,3,6,7,8,9,"); |
|
23 |
|
24 yield blockCell(4); |
|
25 checkGrid("0,1,2,3,7,8,9,,"); |
|
26 |
|
27 // we removed a pinned site |
|
28 yield restore(); |
|
29 yield setLinks("0,1,2,3,4,5,6,7,8"); |
|
30 setPinnedLinks(",1"); |
|
31 |
|
32 yield addNewTabPageTab(); |
|
33 checkGrid("0,1p,2,3,4,5,6,7,8"); |
|
34 |
|
35 yield blockCell(1); |
|
36 checkGrid("0,2,3,4,5,6,7,8,"); |
|
37 |
|
38 // we remove the last site on the grid (which is pinned) and expect the gap |
|
39 // to be re-filled and the new site to be unpinned |
|
40 yield restore(); |
|
41 yield setLinks("0,1,2,3,4,5,6,7,8,9"); |
|
42 setPinnedLinks(",,,,,,,,8"); |
|
43 |
|
44 yield addNewTabPageTab(); |
|
45 checkGrid("0,1,2,3,4,5,6,7,8p"); |
|
46 |
|
47 yield blockCell(8); |
|
48 checkGrid("0,1,2,3,4,5,6,7,9"); |
|
49 |
|
50 // we remove the first site on the grid with the last one pinned. all cells |
|
51 // but the last one should shift to the left and a new site fades in |
|
52 yield restore(); |
|
53 yield setLinks("0,1,2,3,4,5,6,7,8,9"); |
|
54 setPinnedLinks(",,,,,,,,8"); |
|
55 |
|
56 yield addNewTabPageTab(); |
|
57 checkGrid("0,1,2,3,4,5,6,7,8p"); |
|
58 |
|
59 yield blockCell(0); |
|
60 checkGrid("1,2,3,4,5,6,7,9,8p"); |
|
61 } |