[Editor] Make sure the alt-text button is there when pasting an image from an other tab
This commit is contained in:
		
							parent
							
								
									6bb6ce6a5d
								
							
						
					
					
						commit
						0f8dda1af0
					
				@ -265,6 +265,8 @@ class StampEditor extends AnnotationEditor {
 | 
				
			|||||||
    super.render();
 | 
					    super.render();
 | 
				
			||||||
    this.div.hidden = true;
 | 
					    this.div.hidden = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    this.addAltTextButton();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (this.#bitmap) {
 | 
					    if (this.#bitmap) {
 | 
				
			||||||
      this.#createCanvas();
 | 
					      this.#createCanvas();
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
@ -329,7 +331,6 @@ class StampEditor extends AnnotationEditor {
 | 
				
			|||||||
    this._reportTelemetry({
 | 
					    this._reportTelemetry({
 | 
				
			||||||
      action: "inserted_image",
 | 
					      action: "inserted_image",
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    this.addAltTextButton();
 | 
					 | 
				
			||||||
    if (this.#bitmapFileName) {
 | 
					    if (this.#bitmapFileName) {
 | 
				
			||||||
      canvas.setAttribute("aria-label", this.#bitmapFileName);
 | 
					      canvas.setAttribute("aria-label", this.#bitmapFileName);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -21,6 +21,7 @@ import {
 | 
				
			|||||||
  getFirstSerialized,
 | 
					  getFirstSerialized,
 | 
				
			||||||
  kbBigMoveDown,
 | 
					  kbBigMoveDown,
 | 
				
			||||||
  kbBigMoveRight,
 | 
					  kbBigMoveRight,
 | 
				
			||||||
 | 
					  kbCopy,
 | 
				
			||||||
  kbPaste,
 | 
					  kbPaste,
 | 
				
			||||||
  kbSelectAll,
 | 
					  kbSelectAll,
 | 
				
			||||||
  loadAndWait,
 | 
					  loadAndWait,
 | 
				
			||||||
@ -570,4 +571,38 @@ describe("Stamp Editor", () => {
 | 
				
			|||||||
      );
 | 
					      );
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  describe("Copy/paste from a tab to an other", () => {
 | 
				
			||||||
 | 
					    let pages1, pages2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    beforeAll(async () => {
 | 
				
			||||||
 | 
					      pages1 = await loadAndWait("empty.pdf", ".annotationEditorLayer");
 | 
				
			||||||
 | 
					      pages2 = await loadAndWait("empty.pdf", ".annotationEditorLayer");
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    afterAll(async () => {
 | 
				
			||||||
 | 
					      await closePages(pages1);
 | 
				
			||||||
 | 
					      await closePages(pages2);
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    it("must check that the alt-text button is here when pasting in the second tab", async () => {
 | 
				
			||||||
 | 
					      for (let i = 0; i < pages1.length; i++) {
 | 
				
			||||||
 | 
					        const [, page1] = pages1[i];
 | 
				
			||||||
 | 
					        page1.bringToFront();
 | 
				
			||||||
 | 
					        await page1.click("#editorStamp");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        await copyImage(page1, "../images/firefox_logo.png", 0);
 | 
				
			||||||
 | 
					        await kbCopy(page1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        const [, page2] = pages2[i];
 | 
				
			||||||
 | 
					        page2.bringToFront();
 | 
				
			||||||
 | 
					        await page2.click("#editorStamp");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        await kbPaste(page2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        await waitForImage(page2, getEditorSelector(0));
 | 
				
			||||||
 | 
					        await page2.waitForSelector(`${getEditorSelector(0)} .altText`);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user