Fix trash emptying, and do it in batches of 50
This commit is contained in:
parent
87fa51849f
commit
43762248a4
5 changed files with 71 additions and 36 deletions
|
@ -1,3 +1,42 @@
|
|||
describe("Zotero.Items", function() {
|
||||
|
||||
describe("Zotero.Items", function () {
|
||||
var win, collectionsView;
|
||||
|
||||
before(function* () {
|
||||
win = yield loadZoteroPane();
|
||||
collectionsView = win.ZoteroPane.collectionsView;
|
||||
})
|
||||
beforeEach(function () {
|
||||
return selectLibrary(win);
|
||||
})
|
||||
after(function () {
|
||||
win.close();
|
||||
})
|
||||
|
||||
describe("#emptyTrash()", function () {
|
||||
it("should delete items in the trash", function* () {
|
||||
var item1 = createUnsavedDataObject('item');
|
||||
item1.setField('title', 'a');
|
||||
item1.deleted = true;
|
||||
var id1 = yield item1.saveTx();
|
||||
|
||||
var item2 = createUnsavedDataObject('item');
|
||||
item2.setField('title', 'b');
|
||||
item2.deleted = true;
|
||||
var id2 = yield item2.saveTx();
|
||||
|
||||
var item3 = createUnsavedDataObject('item', { itemType: 'attachment', parentID: id2 });
|
||||
item3.attachmentLinkMode = Zotero.Attachments.LINK_MODE_IMPORTED_URL;
|
||||
item3.deleted = true;
|
||||
var id3 = yield item3.saveTx();
|
||||
|
||||
yield collectionsView.selectTrash(Zotero.Libraries.userLibraryID);
|
||||
|
||||
yield Zotero.Items.emptyTrash(Zotero.Libraries.userLibraryID);
|
||||
|
||||
assert.isFalse(yield Zotero.Items.getAsync(id1));
|
||||
assert.isFalse(yield Zotero.Items.getAsync(id2));
|
||||
assert.isFalse(yield Zotero.Items.getAsync(id3));
|
||||
assert.equal(win.ZoteroPane.itemsView.rowCount, 0);
|
||||
})
|
||||
})
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue