Fix item pane test after #5214 (#5220)

This commit is contained in:
windingwind 2025-04-23 23:09:24 +02:00 • committed by GitHub
parent d74db17cf1
commit a63cb647ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -918,6 +918,7 @@ describe("Item pane", function () {
// Unpin
itemDetails.pinnedPane = "";
itemDetails._paneParent.scrollTo(0, 0);
});
it("should keep attachments pane preview status after switching tab", async function () {
@ -1061,6 +1062,7 @@ describe("Item pane", function () {
// Unpin
itemDetails.pinnedPane = "";
itemDetails._paneParent.scrollTo(0, 0);
});
it("should open attachment on clicking attachment row", async function () {
@ -1195,6 +1197,7 @@ describe("Item pane", function () {
assert.isTrue(await isPreviewDisplayed(attachmentsBox));
itemDetails.pinnedPane = "";
itemDetails._paneParent.scrollTo(0, 0);
});
it("should not load preview iframe before becoming visible", async function () {
@ -1205,15 +1208,17 @@ describe("Item pane", function () {
let height = doc.documentElement.clientHeight;
win.resizeTo(null, 100);
// Remove any existing preview to ensure the test is valid
attachmentsBox._preview?.remove();
attachmentsBox._preview = null;
let item = await createDataObject('item');
await importFileAttachment('test.pdf', { parentID: item.id });
await ZoteroPane.selectItem(item.id);
itemDetails._paneParent.scrollTo(0, 0);
// Remove any existing preview to ensure the test is valid
attachmentsBox._preview?.remove();
attachmentsBox._preview = null;
assert.notExists(attachmentsBox._preview);
assert.notExists(attachmentsBox.querySelector("#preview"));
@ -1836,6 +1841,7 @@ describe("Item pane", function () {
);
itemDetails.pinnedPane = "";
itemDetails._paneParent.scrollTo(0, 0);
});
});