|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
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"); |
|
11 |
|
12 yield addNewTabPageTab(); |
|
13 checkGrid("5p,0,1,2,3,4,6,7,8"); |
|
14 |
|
15 yield blockCell(4); |
|
16 yield blockCell(4); |
|
17 checkGrid("5p,0,1,2,6,7,8"); |
|
18 |
|
19 yield undo(); |
|
20 checkGrid("5p,0,1,2,4,6,7,8"); |
|
21 |
|
22 // now remove a pinned site and undo it |
|
23 yield blockCell(0); |
|
24 checkGrid("0,1,2,4,6,7,8"); |
|
25 |
|
26 yield undo(); |
|
27 checkGrid("5p,0,1,2,4,6,7,8"); |
|
28 |
|
29 // remove a site and restore all |
|
30 yield blockCell(1); |
|
31 checkGrid("5p,1,2,4,6,7,8"); |
|
32 |
|
33 yield undoAll(); |
|
34 checkGrid("5p,0,1,2,3,4,6,7,8"); |
|
35 } |
|
36 |
|
37 function undo() { |
|
38 let cw = getContentWindow(); |
|
39 let target = cw.document.getElementById("newtab-undo-button"); |
|
40 EventUtils.synthesizeMouseAtCenter(target, {}, cw); |
|
41 whenPagesUpdated(); |
|
42 } |
|
43 |
|
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 } |