browser/base/content/test/newtab/browser_newtab_unpin.js

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:6bdd03c536ef
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 when a site gets unpinned it is either moved to
6 * its actual place in the grid or removed in case it's not on the grid anymore.
7 */
8 function runTests() {
9 // we have a pinned link that didn't change its position since it was pinned.
10 // nothing should happend when we unpin it.
11 yield setLinks("0,1,2,3,4,5,6,7,8");
12 setPinnedLinks(",1");
13
14 yield addNewTabPageTab();
15 checkGrid("0,1p,2,3,4,5,6,7,8");
16
17 yield unpinCell(1);
18 checkGrid("0,1,2,3,4,5,6,7,8");
19
20 // we have a pinned link that is not anymore in the list of the most-visited
21 // links. this should disappear, the remaining links adjust their positions
22 // and a new link will appear at the end of the grid.
23 yield setLinks("0,1,2,3,4,5,6,7,8");
24 setPinnedLinks(",99");
25
26 yield addNewTabPageTab();
27 checkGrid("0,99p,1,2,3,4,5,6,7");
28
29 yield unpinCell(1);
30 checkGrid("0,1,2,3,4,5,6,7,8");
31
32 // we have a pinned link that changed its position since it was pinned. it
33 // should be moved to its new position after being unpinned.
34 yield setLinks("0,1,2,3,4,5,6,7");
35 setPinnedLinks(",1,,,,,,,0");
36
37 yield addNewTabPageTab();
38 checkGrid("2,1p,3,4,5,6,7,,0p");
39
40 yield unpinCell(1);
41 checkGrid("1,2,3,4,5,6,7,,0p");
42
43 yield unpinCell(8);
44 checkGrid("0,1,2,3,4,5,6,7,");
45
46 // we have pinned link that changed its position since it was pinned. the
47 // link will disappear from the grid because it's now a much lower priority
48 yield setLinks("0,1,2,3,4,5,6,7,8,9");
49 setPinnedLinks("9");
50
51 yield addNewTabPageTab();
52 checkGrid("9p,0,1,2,3,4,5,6,7");
53
54 yield unpinCell(0);
55 checkGrid("0,1,2,3,4,5,6,7,8");
56 }

mercurial