commit 67663497ec222b5397d2091110ce3419bf31a830
parent c1cb832b0b32c4aa2e81ed0a86a001e0d7c2e82e
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 1 Jun 2015 20:02:10 -0400
Allow library and item titles to be set in create(Unsaved)DataObject()
Diffstat:
1 file changed, 13 insertions(+), 0 deletions(-)
diff --git a/test/content/support.js b/test/content/support.js
@@ -191,12 +191,25 @@ var createGroup = Zotero.Promise.coroutine(function* (props) {
// Data objects
//
function createUnsavedDataObject(objectType, params) {
+ if (!objectType) {
+ throw new Error("Object type not provided");
+ }
+
params = params || {};
if (objectType == 'item') {
var param = params.itemType || 'book';
}
var obj = new Zotero[Zotero.Utilities.capitalize(objectType)](param);
+ if (params.libraryID) {
+ obj.libraryID = params.libraryID;
+ }
switch (objectType) {
+ case 'item':
+ if (params.title) {
+ obj.setField('title', params.title);
+ }
+ break;
+
case 'collection':
case 'search':
obj.name = params.name !== undefined ? params.name : "Test";