From 4d439b6440b73c2dc9b64e67d96a0995003dc9e1 Mon Sep 17 00:00:00 2001 From: Julian Gernun <17549662+jcger@users.noreply.github.com> Date: Wed, 29 Nov 2023 16:24:49 +0100 Subject: [PATCH] search by label test --- .../components/all_cases/multi_select_filter.tsx | 6 +++++- .../components/all_cases/table_filters.test.tsx | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/cases/public/components/all_cases/multi_select_filter.tsx b/x-pack/plugins/cases/public/components/all_cases/multi_select_filter.tsx index d6d7756b31adb..cbfdb30d122aa 100644 --- a/x-pack/plugins/cases/public/components/all_cases/multi_select_filter.tsx +++ b/x-pack/plugins/cases/public/components/all_cases/multi_select_filter.tsx @@ -154,7 +154,11 @@ export const MultiSelectFilter = ({ > options={options} searchable - searchProps={{ placeholder: buttonLabel, compressed: false }} + searchProps={{ + placeholder: buttonLabel, + compressed: false, + 'data-test-subj': `${id}-search-input`, + }} emptyMessage={i18n.EMPTY_FILTER_MESSAGE} onChange={_onChange} singleSelection={false} diff --git a/x-pack/plugins/cases/public/components/all_cases/table_filters.test.tsx b/x-pack/plugins/cases/public/components/all_cases/table_filters.test.tsx index cd310cfc1c952..a08e0650e5f2c 100644 --- a/x-pack/plugins/cases/public/components/all_cases/table_filters.test.tsx +++ b/x-pack/plugins/cases/public/components/all_cases/table_filters.test.tsx @@ -190,6 +190,19 @@ describe('CasesTableFilters ', () => { }); }); + it('should show in progress status only when "in p" is searched in the filter', async () => { + appMockRender.render(); + + userEvent.click(screen.getByTestId('options-filter-popover-button-status')); + await waitForEuiPopoverOpen(); + + userEvent.type(screen.getByTestId('status-search-input'), 'in p'); + + const allOptions = screen.getAllByRole('option'); + expect(allOptions).toHaveLength(1); + expect(allOptions[0]).toHaveTextContent('In progress'); + }); + it('should remove assignee from selected assignees when assignee no longer exists', async () => { const overrideProps = { ...props,