diff --git a/chrome/content/zotero/xpcom/search.js b/chrome/content/zotero/xpcom/search.js index 7d3747f70..83cb7f701 100644 --- a/chrome/content/zotero/xpcom/search.js +++ b/chrome/content/zotero/xpcom/search.js @@ -134,9 +134,6 @@ Zotero.Search.prototype.loadFromRow = function (row) { } Zotero.Search.prototype._initSave = Zotero.Promise.coroutine(function* (env) { - if (!this.libraryID) { - throw new Error('libraryID must be set before saving search'); - } if (!this.name) { throw new Error('Name not provided for saved search'); } diff --git a/test/tests/searchTests.js b/test/tests/searchTests.js index 4f53e20c6..eefee65a6 100644 --- a/test/tests/searchTests.js +++ b/test/tests/searchTests.js @@ -1,18 +1,7 @@ describe("Zotero.Search", function() { describe("#save()", function () { - it("should fail without a libraryID", function* () { - var s = new Zotero.Search; - s.name = "Test"; - s.addCondition('title', 'is', 'test'); - var e = yield getPromiseError(s.save()); - assert.ok(e); - assert.equal(e.constructor.name, Error.prototype.constructor.name); // TEMP: Error mismatch - assert.equal(e.message, "libraryID must be set before saving search"); - }); - it("should fail without a name", function* () { var s = new Zotero.Search; - s.libraryID = Zotero.Libraries.userLibraryID; s.addCondition('title', 'is', 'test'); var e = yield getPromiseError(s.save()); assert.ok(e); @@ -23,7 +12,6 @@ describe("Zotero.Search", function() { it("should save a new search", function* () { // Save search var s = new Zotero.Search; - s.libraryID = Zotero.Libraries.userLibraryID; s.name = "Test"; s.addCondition('title', 'is', 'test'); var id = yield s.save(); @@ -33,6 +21,7 @@ describe("Zotero.Search", function() { s = yield Zotero.Searches.getAsync(id); assert.ok(s); assert.instanceOf(s, Zotero.Search); + assert.equal(s.libraryID, Zotero.Libraries.userLibraryID); assert.equal(s.name, "Test"); yield s.loadConditions(); var conditions = s.getConditions();