Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
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("");
15 yield addNewTabPageTab();
16 checkGrid("0,1,2,3,4,5,6,7,8");
18 yield blockCell(4);
19 checkGrid("0,1,2,3,5,6,7,8,9");
21 yield blockCell(4);
22 checkGrid("0,1,2,3,6,7,8,9,");
24 yield blockCell(4);
25 checkGrid("0,1,2,3,7,8,9,,");
27 // we removed a pinned site
28 yield restore();
29 yield setLinks("0,1,2,3,4,5,6,7,8");
30 setPinnedLinks(",1");
32 yield addNewTabPageTab();
33 checkGrid("0,1p,2,3,4,5,6,7,8");
35 yield blockCell(1);
36 checkGrid("0,2,3,4,5,6,7,8,");
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");
44 yield addNewTabPageTab();
45 checkGrid("0,1,2,3,4,5,6,7,8p");
47 yield blockCell(8);
48 checkGrid("0,1,2,3,4,5,6,7,9");
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");
56 yield addNewTabPageTab();
57 checkGrid("0,1,2,3,4,5,6,7,8p");
59 yield blockCell(0);
60 checkGrid("1,2,3,4,5,6,7,9,8p");
61 }