diff --git a/chrome/content/zotero/xpcom/data/itemFields.js b/chrome/content/zotero/xpcom/data/itemFields.js index d18f6a08be..009c5438ac 100644 --- a/chrome/content/zotero/xpcom/data/itemFields.js +++ b/chrome/content/zotero/xpcom/data/itemFields.js @@ -433,13 +433,11 @@ Zotero.ItemFields = new function() { } var fieldName = this.getName(fieldName); - if (!fieldName) { - return 'auto'; - } - - var baseField = this.getBaseIDFromTypeAndField(itemTypeID, fieldName); - if (baseField) { - fieldName = this.getName(baseField); + if (fieldName) { + let baseField = this.getBaseIDFromTypeAndField(itemTypeID, fieldName); + if (baseField) { + fieldName = this.getName(baseField); + } } switch (fieldName) { // Certain fields containing IDs, numbers, and data: always LTR @@ -466,7 +464,8 @@ Zotero.ItemFields = new function() { case 'extra': return 'ltr'; - // Everything else: guess based on the language if we have one; otherwise auto + // Everything else (including false): guess based on the language if we have one; + // otherwise auto default: if (itemLanguage) { let languageCode = Zotero.Utilities.Item.languageToISO6391(itemLanguage); diff --git a/test/tests/itemFieldsTest.js b/test/tests/itemFieldsTest.js index baf35ff764..66a1273c39 100644 --- a/test/tests/itemFieldsTest.js +++ b/test/tests/itemFieldsTest.js @@ -46,12 +46,12 @@ describe("Zotero.ItemFields", function () { }); describe("#getDirection()", function () { - it("should return 'auto' for non-field", function () { - assert.equal(Zotero.ItemFields.getDirection('book', 'creator-0-lastName', ''), 'auto'); - }); - it("should follow app locale for primary field", function () { assert.equal(Zotero.ItemFields.getDirection('book', 'dateAdded', ''), Zotero.dir) }); + + it("should use item language for non-field", function () { + assert.equal(Zotero.ItemFields.getDirection('book', 'creator-0-lastName', 'ar'), 'rtl'); + }); }); })