Fix editing of saved search in a group

This commit is contained in:
Dan Stillman 2016-10-20 22:55:42 -04:00
parent 8a915beaaa
commit 0016c5ecf8
2 changed files with 18 additions and 1 deletions

View file

@ -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: {

View file

@ -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() {