browser/base/content/test/newtab/browser_newtab_undo.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_undo.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,49 @@
     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 the undo dialog works as expected.
     1.9 + */
    1.10 +function runTests() {
    1.11 +  // remove unpinned sites and undo it
    1.12 +  yield setLinks("0,1,2,3,4,5,6,7,8");
    1.13 +  setPinnedLinks("5");
    1.14 +
    1.15 +  yield addNewTabPageTab();
    1.16 +  checkGrid("5p,0,1,2,3,4,6,7,8");
    1.17 +
    1.18 +  yield blockCell(4);
    1.19 +  yield blockCell(4);
    1.20 +  checkGrid("5p,0,1,2,6,7,8");
    1.21 +
    1.22 +  yield undo();
    1.23 +  checkGrid("5p,0,1,2,4,6,7,8");
    1.24 +
    1.25 +  // now remove a pinned site and undo it
    1.26 +  yield blockCell(0);
    1.27 +  checkGrid("0,1,2,4,6,7,8");
    1.28 +
    1.29 +  yield undo();
    1.30 +  checkGrid("5p,0,1,2,4,6,7,8");
    1.31 +
    1.32 +  // remove a site and restore all
    1.33 +  yield blockCell(1);
    1.34 +  checkGrid("5p,1,2,4,6,7,8");
    1.35 +
    1.36 +  yield undoAll();
    1.37 +  checkGrid("5p,0,1,2,3,4,6,7,8");
    1.38 +}
    1.39 +
    1.40 +function undo() {
    1.41 +  let cw = getContentWindow();
    1.42 +  let target = cw.document.getElementById("newtab-undo-button");
    1.43 +  EventUtils.synthesizeMouseAtCenter(target, {}, cw);
    1.44 +  whenPagesUpdated();
    1.45 +}
    1.46 +
    1.47 +function undoAll() {
    1.48 +  let cw = getContentWindow();
    1.49 +  let target = cw.document.getElementById("newtab-undo-restore-button");
    1.50 +  EventUtils.synthesizeMouseAtCenter(target, {}, cw);
    1.51 +  whenPagesUpdated();
    1.52 +}
    1.53 \ No newline at end of file

mercurial