Fix sync error after changing child item to top-level

This commit is contained in:
Dan Stillman 2016-05-15 03:34:06 -04:00
parent a7ea92fd52
commit a8ea8656d2
3 changed files with 26 additions and 0 deletions

View file

@ -1138,6 +1138,18 @@ describe("Zotero.Item", function () {
assert.isUndefined(json.title);
assert.strictEqual(json.deleted, 1);
})
it("should set 'parentItem' to false when cleared", function* () {
var item = yield createDataObject('item');
var note = new Zotero.Item('note');
note.parentID = item.id;
// Create initial JSON with parentItem
var patchBase = note.toJSON();
// Clear parent item and regenerate JSON
note.parentID = false;
var json = note.toJSON({ patchBase });
assert.isFalse(json.parentItem);
});
})
})