Update 'type:' handling when migrating Extra lines

- When changing type based on 'type:' line, move existing fields that
  are no longer valid to Extra
- Remove 'type:' line with CSL type if the item's existing type is one
  of the types mapped to it
This commit is contained in:
Dan Stillman 2020-03-22 15:19:24 -04:00
parent 02b43cbfac
commit 52d5b68564
7 changed files with 145 additions and 40 deletions

View file

@ -129,6 +129,12 @@ describe("Zotero.Utilities.Internal", function () {
assert.strictEqual(extra, '');
});
it("should use the first mapped Zotero type for a CSL type", function () {
var str = 'type: personal_communication';
var { itemType, fields, extra } = Zotero.Utilities.Internal.extractExtraFields(str);
assert.equal(itemType, 'letter');
});
it("should extract a field", function () {
var val = '10.1234/abcdef';
var str = `DOI: ${val}`;