@@ -798,4 +798,44 @@ describe("Comment", () => {
798798 ) ;
799799 } ) ;
800800 } ) ;
801+
802+ describe ( "Focus annotation after comment has been deleted (bug 1994738)" , ( ) => {
803+ let pages ;
804+
805+ beforeEach ( async ( ) => {
806+ pages = await loadAndWait (
807+ "tracemonkey.pdf" ,
808+ ".annotationEditorLayer" ,
809+ "page-fit" ,
810+ null ,
811+ { enableComment : true }
812+ ) ;
813+ } ) ;
814+
815+ afterEach ( async ( ) => {
816+ await closePages ( pages ) ;
817+ } ) ;
818+
819+ it ( "must check that the annotation is focused" , async ( ) => {
820+ await Promise . all (
821+ pages . map ( async ( [ browserName , page ] ) => {
822+ await switchToHighlight ( page ) ;
823+ await highlightSpan ( page , 1 , "Abstract" ) ;
824+ const editorSelector = getEditorSelector ( 0 ) ;
825+ await editComment ( page , editorSelector , "Hello world!" ) ;
826+
827+ await switchToHighlight ( page , /* disable = */ true ) ;
828+ await waitAndClick ( page , ".annotationLayer .annotationCommentButton" ) ;
829+
830+ const handle = await createPromise ( page , resolve => {
831+ document
832+ . querySelector ( ".annotationLayer section.editorAnnotation" )
833+ . addEventListener ( "focus" , resolve , { once : true } ) ;
834+ } ) ;
835+ await waitAndClick ( page , "button.commentPopupDelete" ) ;
836+ await awaitPromise ( handle ) ;
837+ } )
838+ ) ;
839+ } ) ;
840+ } ) ;
801841} ) ;
0 commit comments