Merge pull request #1172 from adomasven/fix/clean-authors

Get a better last name if current guess starts with weird symbols
This commit is contained in:
Dan Stillman 2017-02-18 12:52:45 -05:00 committed by GitHub
commit 07ea9dae84
2 changed files with 22 additions and 3 deletions

View file

@ -16,6 +16,21 @@ describe("Zotero.Utilities", function() {
}
}
});
it('should not parse words starting with symbols as last name', function() {
let author = Zotero.Utilities.cleanAuthor('First Middle Last [CountryName]', false);
assert.equal(author.firstName, 'First Middle');
// Brackets at the beginning and end of a string get removed for strings
// such as [First Last] -> Last, First.
// The current output is not ideal, but better than "[CountryName, First Middle Last"
assert.equal(author.lastName, 'Last [CountryName');
});
it('should parse names starting with unicode characters correctly', function() {
let author = Zotero.Utilities.cleanAuthor('Ąžuolas Žolynas', false);
assert.equal(author.firstName, 'Ąžuolas');
assert.equal(author.lastName, 'Žolynas');
})
});
describe("cleanISBN", function() {
let cleanISBN = Zotero.Utilities.cleanISBN;