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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial