Merge pull request #20838 from calixteman/bug2021886

Avoid to have a thumbnail with two paste buttons (bug 2021886)
This commit is contained in:
Tim van der Meij 2026-03-10 20:21:34 +01:00 committed by GitHub
commit bf20d3c7e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 48 additions and 4 deletions

View File

@ -922,6 +922,52 @@ describe("Reorganize Pages View", () => {
})
);
});
it("should have only one paste button next to the second thumbnail after cut, paste, and copy", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await waitForThumbnailVisible(page, 1);
await page.waitForSelector("#viewsManagerStatusActionButton", {
visible: true,
});
// Select page 1 and cut it.
await waitAndClick(
page,
`.thumbnail:has(${getThumbnailSelector(1)}) input`
);
let handlePagesEdited = await waitForPagesEdited(page, "cut");
await waitAndClick(page, "#viewsManagerStatusActionButton");
await waitAndClick(page, "#viewsManagerStatusActionCut");
await awaitPromise(handlePagesEdited);
// Paste after the new first thumbnail (originally page 2).
handlePagesEdited = await waitForPagesEdited(page);
await waitAndClick(page, `${getThumbnailSelector(1)}+button`);
await awaitPromise(handlePagesEdited);
// Select the new first thumbnail and copy it.
handlePagesEdited = await waitForPagesEdited(page);
await waitAndClick(
page,
`.thumbnail:has(${getThumbnailSelector(1)}) input`
);
await waitAndClick(page, "#viewsManagerStatusActionButton");
await waitAndClick(page, "#viewsManagerStatusActionCopy");
await awaitPromise(handlePagesEdited);
// The second thumbnail should have only one paste button after it.
await page.waitForSelector(
`${getThumbnailSelector(2)} + button.thumbnailPasteButton`,
{ visible: true }
);
const pasteButtons = await page.$$(
`${getThumbnailSelector(2)} + button.thumbnailPasteButton`
);
expect(pasteButtons.length).withContext(`In ${browserName}`).toBe(1);
})
);
});
});
describe("Keyboard shortcuts for cut and copy (bug 2018139)", () => {

View File

@ -818,9 +818,6 @@ class PDFThumbnailViewer {
}
#pastePages(index) {
this.#togglePasteMode(false);
this.#toggleMenuEntries(true);
const pagesMapper = this.#pagesMapper;
let currentPageNumber = this.#copiedPageNumbers.includes(
this._currentPageNumber
@ -840,7 +837,8 @@ class PDFThumbnailViewer {
this.#copiedThumbnails = null;
this.#isCut = false;
this.#updateMenuEntries();
this.#togglePasteMode(false);
this.#toggleMenuEntries(false);
this.#updateStatus("select");
this.#updateCurrentPage(currentPageNumber);