Include proper test for b373291c02 for #2771

This commit is contained in:
Dan Stillman 2022-08-19 02:46:46 -04:00
parent e9e1add9b8
commit 5103d904f3
2 changed files with 37 additions and 12 deletions

View file

@ -0,0 +1,37 @@
describe("CollectionTreeRow", function () {
var win, zp, cv, userLibraryID;
before(async function () {
win = await loadZoteroPane();
zp = win.ZoteroPane;
cv = zp.collectionsView;
userLibraryID = Zotero.Libraries.userLibraryID;
});
beforeEach(function () {
return selectLibrary(win);
});
after(function () {
win.close();
});
describe("Unfiled Items", function () {
// https://github.com/zotero/zotero/issues/2771
it("shouldn't show filed attachments with annotations", async function () {
var item1 = await createDataObject('item');
var collection = await createDataObject('collection');
var item2 = await createDataObject('item', { collections: [collection.id] });
var attachment = await importPDFAttachment(item2);
var annotation = await createAnnotation('highlight', attachment);
cv.selectByID("U" + userLibraryID);
await waitForItemsLoad(win);
var itemsView = zp.itemsView;
assert.isNumber(itemsView.getRowIndexByID(item1.id));
assert.isFalse(itemsView.getRowIndexByID(item2.id));
});
});
});

View file

@ -170,18 +170,6 @@ describe("Zotero.Search", function() {
assert.sameMembers(matches, [item.id]);
});
it("should match child attachment", async function () {
var col = await createDataObject('collection');
var item = await createDataObject('item', { collections: [col.id] });
var attachment = await importPDFAttachment(item);
var s = new Zotero.Search();
s.libraryID = item.libraryID;
s.addCondition('collection', 'is', col.key);
var matches = await s.search();
assert.sameMembers(matches, [item.id, attachment.id]);
});
it("should find items not in collection", function* () {
var col = yield createDataObject('collection');
var item = yield createDataObject('item', { collections: [col.id] });