@@ -268,8 +268,13 @@ describe("Resources", () => {
268268 expect ( screen . getByText ( "Resource 1" ) ) . toBeInTheDocument ( ) ;
269269 } ) ;
270270
271- const resourceBadge = screen . getByText ( "Resource 1" ) ;
272- expect ( resourceBadge ) . toHaveAttribute ( "title" , "Description for resource 1" ) ;
271+ // CardTag wraps content in a button when tooltip is provided
272+ const resourceBadge = screen . getByText ( "Resource 1" ) . closest ( "button" ) ;
273+ expect ( resourceBadge ) . not . toBeNull ( ) ;
274+
275+ // Focus the badge to trigger tooltip (Radix UI behavior)
276+ resourceBadge ! . focus ( ) ;
277+ expect ( await screen . findByRole ( "tooltip" ) ) . toHaveTextContent ( "Description for resource 1" ) ;
273278 } ) ;
274279
275280 it ( "renders more options button for each resource group" , async ( ) => {
@@ -360,8 +365,17 @@ describe("Resources", () => {
360365 expect ( screen . queryByText ( "Resource 9" ) ) . not . toBeInTheDocument ( ) ;
361366 expect ( screen . queryByText ( "Resource 12" ) ) . not . toBeInTheDocument ( ) ;
362367
363- expect ( screen . getByText ( "+4" ) ) . toBeInTheDocument ( ) ;
364- expect ( screen . getByTitle ( "4 more resources" ) ) . toBeInTheDocument ( ) ;
368+ // Check for the +4 badge
369+ const overflowBadge = screen . getByText ( "+4" ) ;
370+ expect ( overflowBadge ) . toBeInTheDocument ( ) ;
371+
372+ // CardTag wraps content in a button when tooltip is provided
373+ const badgeButton = overflowBadge . closest ( "button" ) ;
374+ expect ( badgeButton ) . not . toBeNull ( ) ;
375+
376+ // Focus to trigger tooltip
377+ badgeButton ! . focus ( ) ;
378+ expect ( await screen . findByRole ( "tooltip" ) ) . toHaveTextContent ( "4 more resources" ) ;
365379 } ) ;
366380
367381 it ( "displays all resources when count is 8 or less without +N tag" , async ( ) => {
@@ -396,8 +410,17 @@ describe("Resources", () => {
396410 expect ( screen . getByText ( "gateway-with-nine-resources" ) ) . toBeInTheDocument ( ) ;
397411 } ) ;
398412
399- expect ( screen . getByText ( "+1" ) ) . toBeInTheDocument ( ) ;
400- expect ( screen . getByTitle ( "1 more resource" ) ) . toBeInTheDocument ( ) ;
413+ // Check for the +1 badge
414+ const overflowBadge = screen . getByText ( "+1" ) ;
415+ expect ( overflowBadge ) . toBeInTheDocument ( ) ;
416+
417+ // CardTag wraps content in a button when tooltip is provided
418+ const badgeButton = overflowBadge . closest ( "button" ) ;
419+ expect ( badgeButton ) . not . toBeNull ( ) ;
420+
421+ // Focus to trigger tooltip
422+ badgeButton ! . focus ( ) ;
423+ expect ( await screen . findByRole ( "tooltip" ) ) . toHaveTextContent ( "1 more resource" ) ;
401424 } ) ;
402425
403426 describe ( "Dropdown Menu and Details Panel" , ( ) => {
0 commit comments