itemFieldsTest.js (1020B)
1 "use strict"; 2 3 describe("Zotero.ItemFields", function () { 4 describe("#getBaseIDFromTypeAndField()", function () { 5 it("should return the base field id for an item type and base-mapped field", function* () { 6 assert.equal( 7 Zotero.ItemFields.getBaseIDFromTypeAndField('audioRecording', 'label'), 8 Zotero.ItemFields.getID('publisher') 9 ); 10 11 // Accept ids too 12 assert.equal( 13 Zotero.ItemFields.getBaseIDFromTypeAndField( 14 Zotero.ItemTypes.getID('audioRecording'), 15 Zotero.ItemFields.getID('label') 16 ), 17 Zotero.ItemFields.getID('publisher') 18 ); 19 }) 20 21 it("should return the base field id for an item type and base field", function* () { 22 assert.equal( 23 Zotero.ItemFields.getBaseIDFromTypeAndField('book', 'publisher'), 24 Zotero.ItemFields.getID('publisher') 25 ); 26 }) 27 28 it("should return false for an item type and non-base-mapped field", function* () { 29 assert.isFalse( 30 Zotero.ItemFields.getBaseIDFromTypeAndField('audioRecording', 'runningTime') 31 ); 32 }) 33 }) 34 })