mirror of
https://github.com/zotero/zotero.git
synced 2026-10-04 02:31:47 +00:00
Clear undo/redo history when emptying the trash
This commit is contained in:
parent
189170f968
commit
8f5833061e
2 changed files with 26 additions and 2 deletions
|
|
@ -2562,6 +2562,7 @@ var ZoteroPane = new function () {
|
|||
Zotero.hideZoteroPaneOverlays();
|
||||
}
|
||||
await Zotero.purgeDataObjects();
|
||||
Zotero.UndoHistory.clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -862,8 +862,31 @@ describe("ZoteroPane", function () {
|
|||
assert.isTrue(item.deleted);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
describe("#emptyTrash()", function () {
|
||||
it("should clear the undo/redo history", async function () {
|
||||
// Record an undo entry
|
||||
Zotero.UndoHistory.clear();
|
||||
var collection = await createDataObject('collection', { name: 'Original' });
|
||||
collection.name = 'Renamed';
|
||||
await collection.saveTx({ undoAction: 'undo-action-rename-collection' });
|
||||
assert.isTrue(Zotero.UndoHistory.canUndo());
|
||||
|
||||
// Put something in the trash to empty
|
||||
await createDataObject('item', { deleted: true });
|
||||
|
||||
await selectTrash(win);
|
||||
var promise = waitForDialog();
|
||||
await zp.emptyTrash();
|
||||
await promise;
|
||||
|
||||
assert.isFalse(Zotero.UndoHistory.canUndo());
|
||||
assert.isFalse(Zotero.UndoHistory.canRedo());
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("#setVirtual()", function () {
|
||||
var cv;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue