From 0016c5ecf8dae967f6df2272268d2dd73cbf615c Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 20 Oct 2016 22:55:42 -0400 Subject: [PATCH] Fix editing of saved search in a group --- chrome/content/zotero/zoteroPane.js | 2 +- test/tests/zoteroPaneTest.js | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 245d0ad880..518262b80c 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -2007,7 +2007,7 @@ var ZoteroPane = new function() // applicable, and pass it in. We only need the group that this search belongs // to, if any, since the library drop-down is disabled for saved searches. if (Zotero.Libraries.get(s.libraryID).libraryType == 'group') { - groups.push(yield Zotero.Groups.getByLibraryID(s.libraryID)); + groups.push(Zotero.Groups.getByLibraryID(s.libraryID)); } var io = { dataIn: { diff --git a/test/tests/zoteroPaneTest.js b/test/tests/zoteroPaneTest.js index f7c47eb3ef..7ed98c4be4 100644 --- a/test/tests/zoteroPaneTest.js +++ b/test/tests/zoteroPaneTest.js @@ -409,6 +409,23 @@ describe("ZoteroPane", function() { var conditions = search.getConditions(); assert.lengthOf(Object.keys(conditions), 3); }); + + it("should edit a saved search in a group", function* () { + var group = yield getGroup(); + var search = yield createDataObject('search', { libraryID: group.libraryID }); + var promise = waitForWindow('chrome://zotero/content/searchDialog.xul', function (win) { + let searchBox = win.document.getElementById('search-box'); + var c = searchBox.search.getCondition( + searchBox.search.addCondition("title", "contains", "foo") + ); + searchBox.addCondition(c); + win.document.documentElement.acceptDialog(); + }); + yield zp.editSelectedCollection(); + yield promise; + var conditions = search.getConditions(); + assert.lengthOf(Object.keys(conditions), 3); + }); }); describe("#onCollectionSelected()", function() {