From bf619922c3cfbbb2f24c86f037bcdf571159db9f Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 17 Jun 2026 15:06:48 -0400 Subject: [PATCH] Account for the section header row in multi-collection tests --- test/tests/advancedSearchTest.js | 8 +++++--- test/tests/zoteroPaneTest.js | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/test/tests/advancedSearchTest.js b/test/tests/advancedSearchTest.js index 1dc838e271..24acb0e6a6 100644 --- a/test/tests/advancedSearchTest.js +++ b/test/tests/advancedSearchTest.js @@ -160,11 +160,13 @@ describe("Advanced Search", function () { await deck.pane.submit(); await iv.waitForLoad(); - // Matching items from both collections, but not the matching item - // outside the selected collections - assert.equal(iv.rowCount, 2); + // Matching items from both collections, but not the non-matching item or the + // matching item outside the selected collections (the row count also includes the + // "2 collections selected" section header) assert.isNumber(iv.getRowIndexByID(inFirst.id)); assert.isNumber(iv.getRowIndexByID(inSecond.id)); + assert.isFalse(iv.getRowIndexByID(noMatch.id)); + assert.isFalse(iv.getRowIndexByID(notInCollections.id)); await zp.setAdvancedSearchState('closed'); await selectLibrary(win); diff --git a/test/tests/zoteroPaneTest.js b/test/tests/zoteroPaneTest.js index 58d29239f2..b5fe4bc26f 100644 --- a/test/tests/zoteroPaneTest.js +++ b/test/tests/zoteroPaneTest.js @@ -2236,10 +2236,12 @@ describe("ZoteroPane", function () { await selectMultipleCollections([collection1, collection2]); let itemsView = zp.itemsView; - // Count how many times the item appears + // Count how many times the item appears. Compare the row's ref object + // rather than its id: a section header's ref is the library, whose id can + // collide with an item id in a fresh database. let count = 0; for (let i = 0; i < itemsView.rowCount; i++) { - if (itemsView.getRow(i).ref.id === item.id) { + if (itemsView.getRow(i).ref === item) { count++; } }