diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index 64df05744..22df84b99 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -3829,7 +3829,7 @@ Zotero.Item.prototype.clone = Zotero.Promise.coroutine(function* (libraryID, ski // Regular item if (this.isRegularItem()) { yield this.loadCreators(); - newItem.setCreators(newItem.getCreators()); + newItem.setCreators(this.getCreators()); } else { yield this.loadNote(); diff --git a/test/tests/itemTest.js b/test/tests/itemTest.js index 0472a03a4..14d3f8181 100644 --- a/test/tests/itemTest.js +++ b/test/tests/itemTest.js @@ -424,6 +424,23 @@ describe("Zotero.Item", function () { }) }) + describe("#clone()", function () { + // TODO: Expand to other data + it("should copy creators", function* () { + var item = new Zotero.Item('book'); + item.setCreators([ + { + firstName: "A", + lastName: "Test", + creatorType: 'author' + } + ]); + yield item.save(); + var newItem = yield item.clone(); + assert.sameDeepMembers(item.getCreators(), newItem.getCreators()); + }) + }) + describe("#toJSON()", function () { it("should output only fields with values in default mode", function* () { var itemType = "book";