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