mirror of
https://github.com/zotero/zotero.git
synced 2026-09-26 01:11:23 +00:00
Fix custom trash header persisting after items are restored or deleted. Fixes #5279.
This was due to a logic bug in `getCurrentPane()`, which returned the wrong pane, causing the incorrect one to be updated.
This commit is contained in:
parent
1eacc8bbdf
commit
ed24cce4a1
2 changed files with 25 additions and 1 deletions
|
|
@ -539,7 +539,7 @@
|
|||
if (!mode) {
|
||||
// Guess a mode from the current data
|
||||
// Only annotation items selected
|
||||
if (this.data.every(item => item.isAnnotation())) {
|
||||
if (this.data.length > 0 && this.data.every(item => item.isAnnotation())) {
|
||||
mode = "annotations";
|
||||
}
|
||||
// No/multiple objects are selected OR selected object is a trashed collection/search
|
||||
|
|
|
|||
|
|
@ -209,6 +209,30 @@ describe("Item pane", function () {
|
|||
assert.isFalse(doc.querySelector('item-pane-header .title').hidden);
|
||||
assert.isFalse(doc.querySelector('item-pane-header .creator-year').hidden);
|
||||
});
|
||||
|
||||
it("should update custom header for items in the trash", async function () {
|
||||
var item1 = await createDataObject('item', { deleted: true });
|
||||
var item2 = await createDataObject('item', { deleted: true });
|
||||
|
||||
await selectTrash(win);
|
||||
await ZoteroPane.selectItems([item1.id, item2.id]);
|
||||
await waitForFrame();
|
||||
|
||||
let restoreButton = win.document.querySelector('#zotero-item-message .custom-head .item-restore-button');
|
||||
assert.exists(restoreButton);
|
||||
assert.exists(win.document.querySelector('#zotero-item-message .custom-head .item-delete-button'));
|
||||
|
||||
await restoreButton.click();
|
||||
let ids = await waitForItemEvent('modify');
|
||||
assert.equal(ids.length, 2);
|
||||
await waitForFrame();
|
||||
|
||||
assert.notExists(win.document.querySelector('#zotero-item-message .custom-head .item-restore-button'));
|
||||
|
||||
await item1.eraseTx();
|
||||
await item2.eraseTx();
|
||||
await selectLibrary(win);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Info pane", function () {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue