Fix updating of attachment title in right-hand pane when changed

https://forums.zotero.org/discussion/88225/attached-file-name-doesnt-change-immediately-at-5-0-97-beta-2-8b1b2ee56
This commit is contained in:
Dan Stillman 2021-05-31 03:25:23 -04:00
parent 1daf4b0413
commit 1bf7b1e88e
2 changed files with 16 additions and 1 deletions

View file

@ -169,7 +169,9 @@
}
var noteEditor = this._id('attachment-note-editor')
if (extraData && extraData[id]
if (extraData
&& extraData[id]
&& extraData[id].noteEditorID
&& extraData[id].noteEditorID == noteEditor.instanceID) {
//Zotero.debug("Skipping notification from current attachment note field");
continue;

View file

@ -270,6 +270,19 @@ describe("Item pane", function () {
var label = itemBox._id('fileName');
assert.equal(label.value, newName);
})
it("should update on attachment title change", async function () {
var file = getTestDataDirectory();
file.append('test.png');
var item = await Zotero.Attachments.importFromFile({ file });
var newTitle = 'New Title';
item.setField('title', newTitle);
await item.saveTx();
var itemBox = doc.getElementById('zotero-attachment-box');
var label = itemBox._id('title');
assert.equal(label.textContent, newTitle);
})
})