Make libraryID optional for DataObjects, defaulting to user library

This commit is contained in:
Dan Stillman 2015-04-26 02:09:44 -04:00
parent 30535653a6
commit a2b572665d
3 changed files with 3 additions and 9 deletions

View file

@ -2,20 +2,17 @@ describe("Zotero.Item", function() {
describe("#getField()", function () {
it("should return false for valid unset fields on unsaved items", function* () {
var item = new Zotero.Item('book');
item.libraryID = Zotero.Libraries.userLibraryID;
assert.equal(item.getField('rights'), false);
});
it("should return false for valid unset fields on unsaved items after setting on another field", function* () {
var item = new Zotero.Item('book');
item.libraryID = Zotero.Libraries.userLibraryID;
item.setField('title', 'foo');
assert.equal(item.getField('rights'), false);
});
it("should return false for invalid unset fields on unsaved items after setting on another field", function* () {
var item = new Zotero.Item('book');
item.libraryID = Zotero.Libraries.userLibraryID;
item.setField('title', 'foo');
assert.equal(item.getField('invalid'), false);
});
@ -25,11 +22,9 @@ describe("Zotero.Item", function() {
it("should create a child note", function () {
return Zotero.DB.executeTransaction(function* () {
var item = new Zotero.Item('book');
item.libraryID = Zotero.Libraries.userLibraryID;
var parentItemID = yield item.save();
item = new Zotero.Item('note');
item.libraryID = Zotero.Libraries.userLibraryID;
item.parentID = parentItemID;
var childItemID = yield item.save();