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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/base/content/test/newtab/browser_newtab_unpin.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,56 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +/*
     1.8 + * These tests make sure that when a site gets unpinned it is either moved to
     1.9 + * its actual place in the grid or removed in case it's not on the grid anymore.
    1.10 + */
    1.11 +function runTests() {
    1.12 +  // we have a pinned link that didn't change its position since it was pinned.
    1.13 +  // nothing should happend when we unpin it.
    1.14 +  yield setLinks("0,1,2,3,4,5,6,7,8");
    1.15 +  setPinnedLinks(",1");
    1.16 +
    1.17 +  yield addNewTabPageTab();
    1.18 +  checkGrid("0,1p,2,3,4,5,6,7,8");
    1.19 +
    1.20 +  yield unpinCell(1);
    1.21 +  checkGrid("0,1,2,3,4,5,6,7,8");
    1.22 +
    1.23 +  // we have a pinned link that is not anymore in the list of the most-visited
    1.24 +  // links. this should disappear, the remaining links adjust their positions
    1.25 +  // and a new link will appear at the end of the grid.
    1.26 +  yield setLinks("0,1,2,3,4,5,6,7,8");
    1.27 +  setPinnedLinks(",99");
    1.28 +
    1.29 +  yield addNewTabPageTab();
    1.30 +  checkGrid("0,99p,1,2,3,4,5,6,7");
    1.31 +
    1.32 +  yield unpinCell(1);
    1.33 +  checkGrid("0,1,2,3,4,5,6,7,8");
    1.34 +
    1.35 +  // we have a pinned link that changed its position since it was pinned. it
    1.36 +  // should be moved to its new position after being unpinned.
    1.37 +  yield setLinks("0,1,2,3,4,5,6,7");
    1.38 +  setPinnedLinks(",1,,,,,,,0");
    1.39 +
    1.40 +  yield addNewTabPageTab();
    1.41 +  checkGrid("2,1p,3,4,5,6,7,,0p");
    1.42 +
    1.43 +  yield unpinCell(1);
    1.44 +  checkGrid("1,2,3,4,5,6,7,,0p");
    1.45 +
    1.46 +  yield unpinCell(8);
    1.47 +  checkGrid("0,1,2,3,4,5,6,7,");
    1.48 +
    1.49 +  // we have pinned link that changed its position since it was pinned. the
    1.50 +  // link will disappear from the grid because it's now a much lower priority
    1.51 +  yield setLinks("0,1,2,3,4,5,6,7,8,9");
    1.52 +  setPinnedLinks("9");
    1.53 +
    1.54 +  yield addNewTabPageTab();
    1.55 +  checkGrid("9p,0,1,2,3,4,5,6,7");
    1.56 +
    1.57 +  yield unpinCell(0);
    1.58 +  checkGrid("0,1,2,3,4,5,6,7,8");
    1.59 +}

mercurial