@@ -308,15 +308,43 @@ describe('DisplayIcon', () => {
308308 } )
309309
310310 describe ( 'Event Handling' , ( ) => {
311- it ( 'renders tooltip wrapper that can handle hover events' , async ( ) => {
311+ it ( 'renders interactive tooltip that responds to user events' , async ( ) => {
312312 const user = userEvent . setup ( )
313313 render ( < DisplayIcon item = "starsCount" icons = { mockIcons } /> )
314314
315315 const tooltip = screen . getByTestId ( 'tooltip' )
316316 expect ( tooltip ) . toBeInTheDocument ( )
317317
318+ await user . tab ( )
319+ expect ( tooltip ) . toBeInTheDocument ( )
320+
318321 await user . hover ( tooltip )
319322 expect ( tooltip ) . toBeInTheDocument ( )
323+
324+ await user . unhover ( tooltip )
325+ expect ( tooltip ) . toBeInTheDocument ( )
326+
327+ expect ( tooltip ) . toHaveAttribute ( 'data-tooltip-content' , 'Stars' )
328+ expect ( tooltip ) . toHaveAttribute ( 'data-show-arrow' , 'true' )
329+ } )
330+
331+ it ( 'maintains tooltip accessibility during interactions' , async ( ) => {
332+ const user = userEvent . setup ( )
333+ render ( < DisplayIcon item = "forksCount" icons = { mockIcons } /> )
334+
335+ const tooltip = screen . getByTestId ( 'tooltip' )
336+
337+ await user . tab ( )
338+ expect ( tooltip ) . toBeInTheDocument ( )
339+
340+ expect ( tooltip ) . toHaveAttribute ( 'data-placement' , 'top' )
341+ expect ( tooltip ) . toHaveAttribute ( 'data-delay' , '150' )
342+
343+ const iconElement = screen . getByTestId ( 'font-awesome-icon' )
344+ const textContent = screen . getByText ( '350' )
345+
346+ expect ( iconElement ) . toBeInTheDocument ( )
347+ expect ( textContent ) . toBeInTheDocument ( )
320348 } )
321349 } )
322350} )
0 commit comments