File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -594,5 +594,34 @@ describe("Comment", () => {
594594 } )
595595 ) ;
596596 } ) ;
597+
598+ it ( "must check that comments can be selected/unselected" , async ( ) => {
599+ await Promise . all (
600+ pages . map ( async ( [ browserName , page ] ) => {
601+ await switchToComment ( page ) ;
602+
603+ const firstElementSelector =
604+ "#editorCommentsSidebarList li:first-child" ;
605+ await waitAndClick ( page , firstElementSelector ) ;
606+ const popupSelector = "#commentPopup" ;
607+ await page . waitForSelector ( popupSelector , { visible : true } ) ;
608+ const popupTextSelector = `${ popupSelector } .commentPopupText` ;
609+ await page . waitForSelector ( popupTextSelector , {
610+ visible : true ,
611+ } ) ;
612+ const popupText = await page . evaluate (
613+ selector => document . querySelector ( selector ) . textContent ,
614+ popupTextSelector
615+ ) ;
616+ expect ( popupText )
617+ . withContext ( `In ${ browserName } ` )
618+ . toEqual ( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) ;
619+
620+ // Click again to unselect the comment.
621+ await waitAndClick ( page , firstElementSelector ) ;
622+ await page . waitForSelector ( popupSelector , { visible : false } ) ;
623+ } )
624+ ) ;
625+ } ) ;
597626 } ) ;
598627} ) ;
Original file line number Diff line number Diff line change @@ -575,6 +575,8 @@ class CommentSidebar {
575575
576576 async #commentClick( { currentTarget } ) {
577577 if ( currentTarget . classList . contains ( "selected" ) ) {
578+ currentTarget . classList . remove ( "selected" ) ;
579+ this . #popup. _hide ( ) ;
578580 return ;
579581 }
580582 const annotation = this . #elementsToAnnotations. get ( currentTarget ) ;
You can’t perform that action at this time.
0 commit comments