commit 19b8db590fce1dc6d6082049d1276166e33c2ffc
parent ff7919553c1a8a984f48ee5247786362f742d1a7
Author: Dan Stillman <dstillman@zotero.org>
Date: Sun, 24 May 2015 04:55:54 -0400
Fixes #727, Duplicated items lose their creators
Diffstat:
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git 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
@@ -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";