Fixes #727, Duplicated items lose their creators

This commit is contained in:
Dan Stillman 2015-05-24 04:55:54 -04:00
parent ff7919553c
commit 19b8db590f
2 changed files with 18 additions and 1 deletions

View File

@ -3829,7 +3829,7 @@ Zotero.Item.prototype.clone = Zotero.Promise.coroutine(function* (libraryID, ski
// Regular item // Regular item
if (this.isRegularItem()) { if (this.isRegularItem()) {
yield this.loadCreators(); yield this.loadCreators();
newItem.setCreators(newItem.getCreators()); newItem.setCreators(this.getCreators());
} }
else { else {
yield this.loadNote(); yield this.loadNote();

View File

@ -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 () { describe("#toJSON()", function () {
it("should output only fields with values in default mode", function* () { it("should output only fields with values in default mode", function* () {
var itemType = "book"; var itemType = "book";