Fix "Item collection [n] not found" error after deleting collection
This commit is contained in:
parent
90603c33b4
commit
60b2e16746
2 changed files with 31 additions and 2 deletions
|
@ -35,7 +35,24 @@ describe("Zotero.Collection", function() {
|
|||
|
||||
assert.isTrue((yield Zotero.Items.getAsync(item1.id)).deleted);
|
||||
assert.isTrue((yield Zotero.Items.getAsync(item2.id)).deleted);
|
||||
})
|
||||
});
|
||||
|
||||
it("should clear collection from item cache", function* () {
|
||||
var collection = yield createDataObject('collection');
|
||||
var item = yield createDataObject('item', { collections: [collection.id] });
|
||||
assert.lengthOf(item.getCollections(), 1);
|
||||
yield collection.eraseTx();
|
||||
assert.lengthOf(item.getCollections(), 0);
|
||||
});
|
||||
|
||||
it("should clear subcollection from descendent item cache", function* () {
|
||||
var collection = yield createDataObject('collection');
|
||||
var subcollection = yield createDataObject('collection', { parentID: collection.id });
|
||||
var item = yield createDataObject('item', { collections: [subcollection.id] });
|
||||
assert.lengthOf(item.getCollections(), 1);
|
||||
yield collection.eraseTx();
|
||||
assert.lengthOf(item.getCollections(), 0);
|
||||
});
|
||||
})
|
||||
|
||||
describe("#version", function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue