Default to user library for saved searches
For consistency with collections and items
This commit is contained in:
parent
574f636683
commit
18714a4fcb
2 changed files with 1 additions and 15 deletions
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue