mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-04-09 23:04:02 +02:00
Merge pull request #20838 from calixteman/bug2021886
Avoid to have a thumbnail with two paste buttons (bug 2021886)
This commit is contained in:
commit
bf20d3c7e8
@ -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)", () => {
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user