Fix translation error when firstName is null for fieldMode 1

Some translators (e.g., CrossRef) return firstName: null with fieldMode:
1, which was causing an error
This commit is contained in:
Dan Stillman 2017-02-27 23:34:16 -05:00
parent a35d903e77
commit 6c58389563
2 changed files with 17 additions and 3 deletions

View file

@ -18,4 +18,17 @@ describe("Zotero.Creators", function() {
assert.propertyVal(data2, "lastName", data1.lastName);
});
});
describe("#cleanData()", function () {
it("should allow firstName to be null for fieldMode 1", function* () {
var data = Zotero.Creators.cleanData({
firstName: null,
lastName: "Test",
fieldMode: 1
});
assert.propertyVal(data, 'fieldMode', 1);
assert.propertyVal(data, 'firstName', '');
assert.propertyVal(data, 'lastName', 'Test');
});
});
});