michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /* michael@0: * These tests make sure that the undo dialog works as expected. michael@0: */ michael@0: function runTests() { michael@0: // remove unpinned sites and undo it michael@0: yield setLinks("0,1,2,3,4,5,6,7,8"); michael@0: setPinnedLinks("5"); michael@0: michael@0: yield addNewTabPageTab(); michael@0: checkGrid("5p,0,1,2,3,4,6,7,8"); michael@0: michael@0: yield blockCell(4); michael@0: yield blockCell(4); michael@0: checkGrid("5p,0,1,2,6,7,8"); michael@0: michael@0: yield undo(); michael@0: checkGrid("5p,0,1,2,4,6,7,8"); michael@0: michael@0: // now remove a pinned site and undo it michael@0: yield blockCell(0); michael@0: checkGrid("0,1,2,4,6,7,8"); michael@0: michael@0: yield undo(); michael@0: checkGrid("5p,0,1,2,4,6,7,8"); michael@0: michael@0: // remove a site and restore all michael@0: yield blockCell(1); michael@0: checkGrid("5p,1,2,4,6,7,8"); michael@0: michael@0: yield undoAll(); michael@0: checkGrid("5p,0,1,2,3,4,6,7,8"); michael@0: } michael@0: michael@0: function undo() { michael@0: let cw = getContentWindow(); michael@0: let target = cw.document.getElementById("newtab-undo-button"); michael@0: EventUtils.synthesizeMouseAtCenter(target, {}, cw); michael@0: whenPagesUpdated(); michael@0: } michael@0: michael@0: function undoAll() { michael@0: let cw = getContentWindow(); michael@0: let target = cw.document.getElementById("newtab-undo-restore-button"); michael@0: EventUtils.synthesizeMouseAtCenter(target, {}, cw); michael@0: whenPagesUpdated(); michael@0: }