zotero/test/tests/itemFieldsTest.js
2015-05-27 05:01:48 -04:00

34 lines
1,020 B
JavaScript

"use strict";
describe("Zotero.ItemFields", function () {
describe("#getBaseIDFromTypeAndField()", function () {
it("should return the base field id for an item type and base-mapped field", function* () {
assert.equal(
Zotero.ItemFields.getBaseIDFromTypeAndField('audioRecording', 'label'),
Zotero.ItemFields.getID('publisher')
);
// Accept ids too
assert.equal(
Zotero.ItemFields.getBaseIDFromTypeAndField(
Zotero.ItemTypes.getID('audioRecording'),
Zotero.ItemFields.getID('label')
),
Zotero.ItemFields.getID('publisher')
);
})
it("should return the base field id for an item type and base field", function* () {
assert.equal(
Zotero.ItemFields.getBaseIDFromTypeAndField('book', 'publisher'),
Zotero.ItemFields.getID('publisher')
);
})
it("should return false for an item type and non-base-mapped field", function* () {
assert.isFalse(
Zotero.ItemFields.getBaseIDFromTypeAndField('audioRecording', 'runningTime')
);
})
})
})