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.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     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");
    14   yield addNewTabPageTab();
    15   checkGrid("0,1p,2,3,4,5,6,7,8");
    17   yield unpinCell(1);
    18   checkGrid("0,1,2,3,4,5,6,7,8");
    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");
    26   yield addNewTabPageTab();
    27   checkGrid("0,99p,1,2,3,4,5,6,7");
    29   yield unpinCell(1);
    30   checkGrid("0,1,2,3,4,5,6,7,8");
    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");
    37   yield addNewTabPageTab();
    38   checkGrid("2,1p,3,4,5,6,7,,0p");
    40   yield unpinCell(1);
    41   checkGrid("1,2,3,4,5,6,7,,0p");
    43   yield unpinCell(8);
    44   checkGrid("0,1,2,3,4,5,6,7,");
    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");
    51   yield addNewTabPageTab();
    52   checkGrid("9p,0,1,2,3,4,5,6,7");
    54   yield unpinCell(0);
    55   checkGrid("0,1,2,3,4,5,6,7,8");
    56 }

mercurial