From 0a5610aea0f50a82c818541f83270291788c3061 Mon Sep 17 00:00:00 2001 From: Krum Tyukenov Date: Tue, 22 Jul 2025 16:30:24 +0300 Subject: [PATCH 1/2] RI-7226: fix RiTooltip when title/content is empty --- .../ui/src/components/base/tooltip/RITooltip.tsx | 4 +++- .../src/components/base/tooltip/RiTooltip.spec.tsx | 12 ++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/redisinsight/ui/src/components/base/tooltip/RITooltip.tsx b/redisinsight/ui/src/components/base/tooltip/RITooltip.tsx index b726fa4ffc..1cab839e0c 100644 --- a/redisinsight/ui/src/components/base/tooltip/RITooltip.tsx +++ b/redisinsight/ui/src/components/base/tooltip/RITooltip.tsx @@ -23,7 +23,9 @@ export const RiTooltip = ({ } + content={ + (content || title) && + } placement={position} openDelayDuration={delay} > diff --git a/redisinsight/ui/src/components/base/tooltip/RiTooltip.spec.tsx b/redisinsight/ui/src/components/base/tooltip/RiTooltip.spec.tsx index 8261035ea9..49ba16d101 100644 --- a/redisinsight/ui/src/components/base/tooltip/RiTooltip.spec.tsx +++ b/redisinsight/ui/src/components/base/tooltip/RiTooltip.spec.tsx @@ -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 is provided', async () => { render( - + , ) @@ -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() From 8d2aa16c1dfc88511e5e74e8c781311588feb77a Mon Sep 17 00:00:00 2001 From: Krum Tyukenov Date: Tue, 22 Jul 2025 17:23:38 +0300 Subject: [PATCH 2/2] update test name --- redisinsight/ui/src/components/base/tooltip/RiTooltip.spec.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redisinsight/ui/src/components/base/tooltip/RiTooltip.spec.tsx b/redisinsight/ui/src/components/base/tooltip/RiTooltip.spec.tsx index 49ba16d101..75c4b9bc76 100644 --- a/redisinsight/ui/src/components/base/tooltip/RiTooltip.spec.tsx +++ b/redisinsight/ui/src/components/base/tooltip/RiTooltip.spec.tsx @@ -62,7 +62,7 @@ describe('RiTooltip', () => { expect(screen.queryByRole('heading')).not.toBeInTheDocument() }) - it('should not render tooltip when content and title is provided', async () => { + it('should not render tooltip when content and title are not provided', async () => { render(