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

mercurial