Fix clearing of annotation fields

This commit is contained in:
Dan Stillman 2020-12-26 02:33:40 -05:00
parent 69958d4356
commit 6ee3863e37
2 changed files with 12 additions and 1 deletions

View file

@ -274,5 +274,16 @@ describe("Zotero.Annotations", function() {
assert.deepEqual(annotation[itemProp], exampleImageAlt[prop], `'${prop}' doesn't match`);
}
});
it("should remove empty fields", async function () {
var annotation = await Zotero.Annotations.saveFromJSON(attachment, exampleHighlight);
var json = Object.assign({}, exampleHighlight);
json.comment = '';
json.pageLabel = '';
await Zotero.Annotations.saveFromJSON(attachment, json);
assert.equal(annotation.annotationComment, '');
assert.equal(annotation.annotationPageLabel, '');
});
});
})