browser/base/content/test/newtab/browser_newtab_undo.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 the undo dialog works as expected.
michael@0 6 */
michael@0 7 function runTests() {
michael@0 8 // remove unpinned sites and undo it
michael@0 9 yield setLinks("0,1,2,3,4,5,6,7,8");
michael@0 10 setPinnedLinks("5");
michael@0 11
michael@0 12 yield addNewTabPageTab();
michael@0 13 checkGrid("5p,0,1,2,3,4,6,7,8");
michael@0 14
michael@0 15 yield blockCell(4);
michael@0 16 yield blockCell(4);
michael@0 17 checkGrid("5p,0,1,2,6,7,8");
michael@0 18
michael@0 19 yield undo();
michael@0 20 checkGrid("5p,0,1,2,4,6,7,8");
michael@0 21
michael@0 22 // now remove a pinned site and undo it
michael@0 23 yield blockCell(0);
michael@0 24 checkGrid("0,1,2,4,6,7,8");
michael@0 25
michael@0 26 yield undo();
michael@0 27 checkGrid("5p,0,1,2,4,6,7,8");
michael@0 28
michael@0 29 // remove a site and restore all
michael@0 30 yield blockCell(1);
michael@0 31 checkGrid("5p,1,2,4,6,7,8");
michael@0 32
michael@0 33 yield undoAll();
michael@0 34 checkGrid("5p,0,1,2,3,4,6,7,8");
michael@0 35 }
michael@0 36
michael@0 37 function undo() {
michael@0 38 let cw = getContentWindow();
michael@0 39 let target = cw.document.getElementById("newtab-undo-button");
michael@0 40 EventUtils.synthesizeMouseAtCenter(target, {}, cw);
michael@0 41 whenPagesUpdated();
michael@0 42 }
michael@0 43
michael@0 44 function undoAll() {
michael@0 45 let cw = getContentWindow();
michael@0 46 let target = cw.document.getElementById("newtab-undo-restore-button");
michael@0 47 EventUtils.synthesizeMouseAtCenter(target, {}, cw);
michael@0 48 whenPagesUpdated();
michael@0 49 }

mercurial