File tree Expand file tree Collapse file tree
src/course-home/progress-tab/grades/grade-summary Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,4 +101,27 @@ describe('GradeSummaryHeader', () => {
101101
102102 document . body . removeChild ( blurTarget ) ;
103103 } ) ;
104+
105+ it ( 'hides tooltip when Escape is pressed (covers handleKeyDown)' , async ( ) => {
106+ renderComponent ( ) ;
107+
108+ const iconButton = screen . getByRole ( 'button' , {
109+ name : messages . gradeSummaryTooltipAlt . defaultMessage ,
110+ } ) ;
111+
112+ await userEvent . hover ( iconButton ) ;
113+ await userEvent . click ( iconButton ) ;
114+
115+ await waitFor ( ( ) => {
116+ expect ( screen . getByText ( messages . gradeSummaryTooltipBody . defaultMessage ) ) . toBeInTheDocument ( ) ;
117+ } ) ;
118+
119+ fireEvent . keyDown ( iconButton , { key : 'Escape' , code : 'Escape' } ) ;
120+
121+ await userEvent . unhover ( iconButton ) ;
122+
123+ await waitFor ( ( ) => {
124+ expect ( screen . queryByText ( messages . gradeSummaryTooltipBody . defaultMessage ) ) . not . toBeInTheDocument ( ) ;
125+ } ) ;
126+ } ) ;
104127} ) ;
You can’t perform that action at this time.
0 commit comments