fx-compat: Fix blurring of textarea fields in item box

And fix tests
This commit is contained in:
Dan Stillman 2022-06-21 03:03:18 -04:00
parent 563f91bf18
commit 587ae6ba7e
2 changed files with 3 additions and 3 deletions

View file

@ -2293,7 +2293,7 @@
blurOpenField() { blurOpenField() {
return (async function () { return (async function () {
var activeField = this._infoTable.querySelector('input'); var activeField = this._infoTable.querySelector('input, textarea');
if (!activeField) { if (!activeField) {
return false; return false;
} }

View file

@ -19,7 +19,7 @@ describe("ZoteroPane", function() {
it("should create an item and focus the title field", function* () { it("should create an item and focus the title field", function* () {
yield zp.newItem(Zotero.ItemTypes.getID('book'), {}, null, true); yield zp.newItem(Zotero.ItemTypes.getID('book'), {}, null, true);
var itemBox = doc.getElementById('zotero-editpane-item-box'); var itemBox = doc.getElementById('zotero-editpane-item-box');
var textboxes = doc.getAnonymousNodes(itemBox)[0].getElementsByTagName('textbox'); var textboxes = itemBox.shadowRoot.querySelectorAll('input, textarea');
assert.lengthOf(textboxes, 1); assert.lengthOf(textboxes, 1);
assert.equal(textboxes[0].getAttribute('fieldname'), 'title'); assert.equal(textboxes[0].getAttribute('fieldname'), 'title');
textboxes[0].blur(); textboxes[0].blur();
@ -30,7 +30,7 @@ describe("ZoteroPane", function() {
var value = "Test"; var value = "Test";
var item = yield zp.newItem(Zotero.ItemTypes.getID('book'), {}, null, true); var item = yield zp.newItem(Zotero.ItemTypes.getID('book'), {}, null, true);
var itemBox = doc.getElementById('zotero-editpane-item-box'); var itemBox = doc.getElementById('zotero-editpane-item-box');
var textbox = doc.getAnonymousNodes(itemBox)[0].getElementsByTagName('textbox')[0]; var textbox = itemBox.shadowRoot.querySelector('textarea');
textbox.value = value; textbox.value = value;
yield itemBox.blurOpenField(); yield itemBox.blurOpenField();
item = yield Zotero.Items.getAsync(item.id); item = yield Zotero.Items.getAsync(item.id);