@@ -373,6 +373,36 @@ describe("Comment", () => {
373373 } )
374374 ) ;
375375 } ) ;
376+
377+ it ( "must check that the button is removed in the annotation layer" , async ( ) => {
378+ await Promise . all (
379+ pages . map ( async ( [ , page ] ) => {
380+ await switchToHighlight ( page ) ;
381+
382+ await highlightSpan ( page , 1 , "Abstract" ) ;
383+ const editorSelector = getEditorSelector ( 0 ) ;
384+ await editComment ( page , editorSelector , "Hello world!" ) ;
385+
386+ await switchToHighlight ( page , /* disable = */ true ) ;
387+ const buttonSelector = ".annotationLayer .annotationCommentButton" ;
388+ await page . waitForSelector ( buttonSelector , {
389+ visible : true ,
390+ } ) ;
391+
392+ await switchToHighlight ( page ) ;
393+ await selectEditor ( page , editorSelector ) ;
394+ await waitAndClick ( page , `${ editorSelector } button.deleteButton` ) ;
395+ await waitForSerialized ( page , 0 ) ;
396+
397+ await switchToHighlight ( page , /* disable = */ true ) ;
398+ await page . waitForFunction (
399+ sel => ! document . querySelector ( sel ) ,
400+ { } ,
401+ buttonSelector
402+ ) ;
403+ } )
404+ ) ;
405+ } ) ;
376406 } ) ;
377407
378408 describe ( "Focused element after editing" , ( ) => {
@@ -624,4 +654,50 @@ describe("Comment", () => {
624654 ) ;
625655 } ) ;
626656 } ) ;
657+
658+ describe ( "Comment popup" , ( ) => {
659+ let pages ;
660+
661+ beforeEach ( async ( ) => {
662+ pages = await loadAndWait (
663+ "tracemonkey.pdf" ,
664+ ".annotationEditorLayer" ,
665+ "page-width" ,
666+ null ,
667+ { enableComment : true }
668+ ) ;
669+ } ) ;
670+
671+ afterEach ( async ( ) => {
672+ await closePages ( pages ) ;
673+ } ) ;
674+
675+ it ( "must check that the popup is deleted when the editor is" , async ( ) => {
676+ await Promise . all (
677+ pages . map ( async ( [ , page ] ) => {
678+ await switchToHighlight ( page ) ;
679+
680+ await highlightSpan ( page , 1 , "Abstract" ) ;
681+ const editorSelector = getEditorSelector ( 0 ) ;
682+ await editComment ( page , editorSelector , "Hello world!" ) ;
683+
684+ await waitAndClick (
685+ page ,
686+ `${ editorSelector } button.annotationCommentButton`
687+ ) ;
688+
689+ const popupSelector = "#commentPopup" ;
690+ await page . waitForSelector ( popupSelector , { visible : true } ) ;
691+ await waitAndClick ( page , `${ editorSelector } button.deleteButton` ) ;
692+
693+ // Check that the popup is removed from the DOM.
694+ await page . waitForFunction (
695+ sel => ! document . querySelector ( sel ) ,
696+ { } ,
697+ popupSelector
698+ ) ;
699+ } )
700+ ) ;
701+ } ) ;
702+ } ) ;
627703} ) ;
0 commit comments