From 5103d904f3cd32dd41d69f9b3f25ea6b4dc465df Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 19 Aug 2022 02:46:46 -0400 Subject: [PATCH] Include proper test for b373291c02 for #2771 --- test/tests/collectionTreeRowTest.js | 37 +++++++++++++++++++++++++++++ test/tests/searchTest.js | 12 ---------- 2 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 test/tests/collectionTreeRowTest.js diff --git a/test/tests/collectionTreeRowTest.js b/test/tests/collectionTreeRowTest.js new file mode 100644 index 0000000000..6fdbe0eb4d --- /dev/null +++ b/test/tests/collectionTreeRowTest.js @@ -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)); + }); + }); +}); \ No newline at end of file diff --git a/test/tests/searchTest.js b/test/tests/searchTest.js index 23c2efc4c3..dcb69b414d 100644 --- a/test/tests/searchTest.js +++ b/test/tests/searchTest.js @@ -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] });