From 67663497ec222b5397d2091110ce3419bf31a830 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 1 Jun 2015 20:02:10 -0400 Subject: [PATCH] Allow library and item titles to be set in create(Unsaved)DataObject() --- test/content/support.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/content/support.js b/test/content/support.js index 7390eb3c1..ae3f10b1e 100644 --- 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";