www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 18714a4fcb387be510911b9b417323a04e47cf86
parent 574f6366832edbffd75952bea3dd32e4298f8fd9
Author: Dan Stillman <dstillman@zotero.org>
Date:   Tue,  5 May 2015 03:13:08 -0400

Default to user library for saved searches

For consistency with collections and items

Diffstat:
Mchrome/content/zotero/xpcom/search.js | 3---
Mtest/tests/searchTests.js | 13+------------
2 files changed, 1 insertion(+), 15 deletions(-)

diff --git 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 @@ -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();