Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion redisinsight/ui/src/components/base/tooltip/RITooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ export const RiTooltip = ({
<TooltipProvider>
<Tooltip
{...props}
content={content && <HoverContent title={title} content={content} />}
content={
(content || title) && <HoverContent title={title} content={content} />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the test - content && title?

Copy link
Collaborator Author

@KrumTy KrumTy Jul 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's a test that cover this already; I 've renamed the current test

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, that changes my expectations :D

}
placement={position}
openDelayDuration={delay}
>
Expand Down
12 changes: 8 additions & 4 deletions redisinsight/ui/src/components/base/tooltip/RiTooltip.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ describe('RiTooltip', () => {
expect(screen.queryByRole('heading')).not.toBeInTheDocument()
})

it('should not render tooltip when content is not provided', async () => {
it('should not render tooltip when content and title are not provided', async () => {
render(
<RiTooltip title="Test Title">
<RiTooltip>
<TestButton />
</RiTooltip>,
)
Expand Down Expand Up @@ -119,8 +119,12 @@ describe('RiTooltip', () => {
})
await waitForRiTooltipVisible()

expect(screen.getAllByTestId('tooltip-custom-content')[0]).toBeInTheDocument()
expect(screen.getAllByText('Custom content with HTML')[0]).toBeInTheDocument()
expect(
screen.getAllByTestId('tooltip-custom-content')[0],
).toBeInTheDocument()
expect(
screen.getAllByText('Custom content with HTML')[0],
).toBeInTheDocument()
expect(
screen.getAllByRole('button', { name: 'Hover me' })[0],
).toBeInTheDocument()
Expand Down
Loading