Clear item creators when calling setCreators() with an empty array

This commit is contained in:
Dan Stillman 2016-04-07 19:32:34 -04:00
parent 79748b9132
commit 14341ca16c
2 changed files with 23 additions and 0 deletions

View file

@ -435,6 +435,21 @@ describe("Zotero.Item", function () {
item = Zotero.Items.get(id);
assert.sameDeepMembers(item.getCreators(), creators);
})
it("should clear creators if empty array passed", function () {
var item = createUnsavedDataObject('item');
item.setCreators([
{
firstName: "First",
lastName: "Last",
fieldMode: 0,
creatorTypeID: 1
}
]);
assert.lengthOf(item.getCreators(), 1);
item.setCreators([]);
assert.lengthOf(item.getCreators(), 0);
});
})
describe("#getAttachments()", function () {