Don't set collections: "" in PATCH JSON when changing item to child
This commit is contained in:
parent
5c32962bb1
commit
0803bb84e3
2 changed files with 16 additions and 0 deletions
|
@ -132,6 +132,11 @@ Zotero.DataObjectUtilities = {
|
|||
// If field from base doesn't exist in new version, clear it
|
||||
else {
|
||||
switch (i) {
|
||||
// When changing an item from top-level to child, the collections property is
|
||||
// no valid, so it doesn't need to be cleared
|
||||
case 'collections':
|
||||
break;
|
||||
|
||||
case 'deleted':
|
||||
target[i] = false;
|
||||
break;
|
||||
|
|
|
@ -1,6 +1,17 @@
|
|||
"use strict";
|
||||
|
||||
describe("Zotero.DataObjectUtilities", function() {
|
||||
describe("#patch()", function () {
|
||||
it("should omit 'collections' if it doesn't exist", function* () {
|
||||
var patchBase = {
|
||||
collections: ['AAAAAAAA']
|
||||
};
|
||||
var obj = {};
|
||||
obj = Zotero.DataObjectUtilities.patch(patchBase, obj);
|
||||
assert.notProperty(obj, 'collections');
|
||||
})
|
||||
})
|
||||
|
||||
describe("#diff()", function () {
|
||||
// This is mostly covered by syncLocal::_reconcileChanges() tests, but we test some
|
||||
// additional things here
|
||||
|
|
Loading…
Reference in a new issue