From ba96eef4330c96c19fd2bc8247f59220c3c74121 Mon Sep 17 00:00:00 2001 From: Esteban Beltran Date: Thu, 12 May 2022 10:16:44 +0200 Subject: [PATCH] [Cases] Show a tooltip with all tags when tags are hovered in the cases list (#132023) --- .../all_cases/all_cases_list.test.tsx | 18 ++++++++++++++++ .../public/components/all_cases/columns.tsx | 21 ++++++++++++------- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/cases/public/components/all_cases/all_cases_list.test.tsx b/x-pack/plugins/cases/public/components/all_cases/all_cases_list.test.tsx index 22e12d5ee11b5..f23dd65d01ec2 100644 --- a/x-pack/plugins/cases/public/components/all_cases/all_cases_list.test.tsx +++ b/x-pack/plugins/cases/public/components/all_cases/all_cases_list.test.tsx @@ -215,6 +215,24 @@ describe('AllCasesListGeneric', () => { }); }); + it('should show a tooltip with all tags when hovered', async () => { + useGetCasesMock.mockReturnValue({ + ...defaultGetCases, + filterOptions: { ...defaultGetCases.filterOptions, status: CaseStatuses.open }, + }); + const result = render( + + + + ); + + userEvent.hover(result.queryAllByTestId('case-table-column-tags')[0]); + + await waitFor(() => { + expect(result.getByTestId('case-table-column-tags-tooltip')).toBeTruthy(); + }); + }); + it('should render empty fields', async () => { useGetCasesMock.mockReturnValue({ ...defaultGetCases, diff --git a/x-pack/plugins/cases/public/components/all_cases/columns.tsx b/x-pack/plugins/cases/public/components/all_cases/columns.tsx index 43096d3de061c..c895dfdc11f3f 100644 --- a/x-pack/plugins/cases/public/components/all_cases/columns.tsx +++ b/x-pack/plugins/cases/public/components/all_cases/columns.tsx @@ -19,6 +19,7 @@ import { EuiFlexItem, EuiIcon, EuiHealth, + EuiToolTip, } from '@elastic/eui'; import { RIGHT_ALIGNMENT } from '@elastic/eui/lib/services'; import styled from 'styled-components'; @@ -56,10 +57,6 @@ const Spacer = styled.span` margin-left: ${({ theme }) => theme.eui.paddingSizes.s}; `; -const TagWrapper = styled(EuiBadgeGroup)` - width: 100%; -`; - const renderStringField = (field: string, dataTestSubj: string) => field != null ? {field} : getEmptyTagValue(); @@ -205,8 +202,8 @@ export const useCasesColumns = ({ name: i18n.TAGS, render: (tags: Case['tags']) => { if (tags != null && tags.length > 0) { - return ( - + const badges = ( + {tags.map((tag: string, i: number) => ( ))} - + + ); + + return ( + + {badges} + ); } return getEmptyTagValue();