citeTest.js (1043B)
1 describe("Zotero.Cite", function () { 2 describe("#extraToCSL()", function () { 3 it("should convert Extra field values to the more restrictive citeproc-js cheater syntax", function () { 4 var str1 = 'Original Date: 2017\n' // uppercase/spaces converted to lowercase/hyphens 5 + 'Archive-Place: New York\n' // allow hyphen even with title case 6 + 'Container title: Title\n' // mixed case 7 + 'DOI: 10.0/abc\n' // certain fields are uppercase 8 + 'Archive Location: Foo\n' // requires an underscore 9 + 'Original Publisher Place: London, UK\n' // extra space OK 10 + '\n\n' 11 + "Ignore other strings: they're not fields\n" 12 + 'This is just some text.' 13 var str2 = 'original-date: 2017\n' 14 + 'archive-place: New York\n' 15 + 'container-title: Title\n' 16 + 'DOI: 10.0/abc\n' 17 + 'archive_location: Foo\n' 18 + 'original-publisher-place: London, UK\n' 19 + '\n\n' 20 + "Ignore other strings: they're not fields\n" 21 + 'This is just some text.'; 22 assert.equal(Zotero.Cite.extraToCSL(str1), str2); 23 }); 24 }); 25 });