File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
redisinsight/ui/src/components/base/tooltip Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,9 @@ export const RiTooltip = ({
2323 < TooltipProvider >
2424 < Tooltip
2525 { ...props }
26- content = { content && < HoverContent title = { title } content = { content } /> }
26+ content = {
27+ ( content || title ) && < HoverContent title = { title } content = { content } />
28+ }
2729 placement = { position }
2830 openDelayDuration = { delay }
2931 >
Original file line number Diff line number Diff line change @@ -62,9 +62,9 @@ describe('RiTooltip', () => {
6262 expect ( screen . queryByRole ( 'heading' ) ) . not . toBeInTheDocument ( )
6363 } )
6464
65- it ( 'should not render tooltip when content is not provided' , async ( ) => {
65+ it ( 'should not render tooltip when content and title are not provided' , async ( ) => {
6666 render (
67- < RiTooltip title = "Test Title" >
67+ < RiTooltip >
6868 < TestButton />
6969 </ RiTooltip > ,
7070 )
@@ -119,8 +119,12 @@ describe('RiTooltip', () => {
119119 } )
120120 await waitForRiTooltipVisible ( )
121121
122- expect ( screen . getAllByTestId ( 'tooltip-custom-content' ) [ 0 ] ) . toBeInTheDocument ( )
123- expect ( screen . getAllByText ( 'Custom content with HTML' ) [ 0 ] ) . toBeInTheDocument ( )
122+ expect (
123+ screen . getAllByTestId ( 'tooltip-custom-content' ) [ 0 ] ,
124+ ) . toBeInTheDocument ( )
125+ expect (
126+ screen . getAllByText ( 'Custom content with HTML' ) [ 0 ] ,
127+ ) . toBeInTheDocument ( )
124128 expect (
125129 screen . getAllByRole ( 'button' , { name : 'Hover me' } ) [ 0 ] ,
126130 ) . toBeInTheDocument ( )
You can’t perform that action at this time.
0 commit comments