mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-11 09:35:49 +02:00
Avoid to have a thumbnail with two paste buttons (bug 2021886)
This commit is contained in:
parent
cc680f68c3
commit
645ef08764
@ -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)", () => {
|
describe("Keyboard shortcuts for cut and copy (bug 2018139)", () => {
|
||||||
|
|||||||
@ -818,9 +818,6 @@ class PDFThumbnailViewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pastePages(index) {
|
#pastePages(index) {
|
||||||
this.#togglePasteMode(false);
|
|
||||||
this.#toggleMenuEntries(true);
|
|
||||||
|
|
||||||
const pagesMapper = this.#pagesMapper;
|
const pagesMapper = this.#pagesMapper;
|
||||||
let currentPageNumber = this.#copiedPageNumbers.includes(
|
let currentPageNumber = this.#copiedPageNumbers.includes(
|
||||||
this._currentPageNumber
|
this._currentPageNumber
|
||||||
@ -840,7 +837,8 @@ class PDFThumbnailViewer {
|
|||||||
|
|
||||||
this.#copiedThumbnails = null;
|
this.#copiedThumbnails = null;
|
||||||
this.#isCut = false;
|
this.#isCut = false;
|
||||||
this.#updateMenuEntries();
|
this.#togglePasteMode(false);
|
||||||
|
this.#toggleMenuEntries(false);
|
||||||
this.#updateStatus("select");
|
this.#updateStatus("select");
|
||||||
|
|
||||||
this.#updateCurrentPage(currentPageNumber);
|
this.#updateCurrentPage(currentPageNumber);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user