-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Cases]: Redesign all cases list select modal (#149851)
## Summary This PR Fixes: #139194 I Removes below columns and filters from Cases select modal. **Columns** - Tags - Reporters/Assignees - Solution - Comments - Alerts - Updated On - Status - External Incident **Filters** - Reporters/Assignees - Create case button (Create case button will be visible when there are no cases available) **Before** ![image](https://user-images.githubusercontent.com/117571355/216052295-e1788c80-357b-4f38-a2ac-9ce980dbeac9.png) **After:** **Updated** ![image](https://user-images.githubusercontent.com/117571355/216375245-382e58f2-46c6-4c39-b13a-81f439dd5a94.png) ![image](https://user-images.githubusercontent.com/117571355/216375410-f6cbbae7-40c9-4b94-83f4-c756379971a5.png) Flaky test runner: https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1867 ### Checklist Delete any items that are not applicable to this PR. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [x] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [x] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### For maintainers - [x] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
5b366b9
commit daf1304
Showing
16 changed files
with
698 additions
and
467 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
x-pack/plugins/cases/public/components/all_cases/solution_filter.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { waitForEuiPopoverOpen } from '@elastic/eui/lib/test/rtl'; | ||
|
||
import type { AppMockRenderer } from '../../common/mock'; | ||
import { createAppMockRenderer } from '../../common/mock'; | ||
import type { Solution } from './types'; | ||
import { | ||
OWNER_INFO, | ||
SECURITY_SOLUTION_OWNER, | ||
OBSERVABILITY_OWNER, | ||
} from '../../../common/constants'; | ||
|
||
import { SolutionFilter } from './solution_filter'; | ||
import userEvent from '@testing-library/user-event'; | ||
|
||
describe('SolutionFilter ', () => { | ||
let appMockRender: AppMockRenderer; | ||
const onSelectedOptionsChanged = jest.fn(); | ||
const solutions: Solution[] = [ | ||
{ | ||
id: SECURITY_SOLUTION_OWNER, | ||
label: OWNER_INFO[SECURITY_SOLUTION_OWNER].label, | ||
iconType: OWNER_INFO[SECURITY_SOLUTION_OWNER].iconType, | ||
}, | ||
{ | ||
id: OBSERVABILITY_OWNER, | ||
label: OWNER_INFO[OBSERVABILITY_OWNER].label, | ||
iconType: OWNER_INFO[OBSERVABILITY_OWNER].iconType, | ||
}, | ||
]; | ||
|
||
beforeEach(() => { | ||
appMockRender = createAppMockRenderer(); | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
it('renders button correctly', () => { | ||
const { getByTestId } = appMockRender.render( | ||
<SolutionFilter | ||
onSelectedOptionsChanged={onSelectedOptionsChanged} | ||
selectedOptions={[]} | ||
options={solutions} | ||
/> | ||
); | ||
|
||
expect(getByTestId('solution-filter-popover-button')).toBeInTheDocument(); | ||
}); | ||
|
||
it('renders empty label correctly', async () => { | ||
const { getByTestId, getByText } = appMockRender.render( | ||
<SolutionFilter | ||
onSelectedOptionsChanged={onSelectedOptionsChanged} | ||
selectedOptions={[]} | ||
options={[]} | ||
optionsEmptyLabel="No options available" | ||
/> | ||
); | ||
|
||
userEvent.click(getByTestId('solution-filter-popover-button')); | ||
|
||
await waitForEuiPopoverOpen(); | ||
|
||
expect(getByText('No options available')).toBeInTheDocument(); | ||
}); | ||
|
||
it('renders options correctly', async () => { | ||
const { getByTestId } = appMockRender.render( | ||
<SolutionFilter | ||
onSelectedOptionsChanged={onSelectedOptionsChanged} | ||
selectedOptions={[]} | ||
options={solutions} | ||
/> | ||
); | ||
|
||
expect(getByTestId('solution-filter-popover-button')).toBeInTheDocument(); | ||
|
||
userEvent.click(getByTestId('solution-filter-popover-button')); | ||
|
||
await waitForEuiPopoverOpen(); | ||
|
||
expect(getByTestId(`solution-filter-popover-item-${solutions[0].id}`)).toBeInTheDocument(); | ||
expect(getByTestId(`solution-filter-popover-item-${solutions[0].id}`)).toBeInTheDocument(); | ||
}); | ||
|
||
it('should call onSelectionChange with selected solution id', async () => { | ||
const { getByTestId } = appMockRender.render( | ||
<SolutionFilter | ||
onSelectedOptionsChanged={onSelectedOptionsChanged} | ||
selectedOptions={[]} | ||
options={solutions} | ||
/> | ||
); | ||
|
||
userEvent.click(getByTestId('solution-filter-popover-button')); | ||
|
||
await waitForEuiPopoverOpen(); | ||
|
||
userEvent.click(getByTestId(`solution-filter-popover-item-${solutions[0].id}`)); | ||
|
||
expect(onSelectedOptionsChanged).toHaveBeenCalledWith([solutions[0].id]); | ||
}); | ||
|
||
it('should call onSelectionChange with empty array when solution option is deselected', async () => { | ||
const { getByTestId } = appMockRender.render( | ||
<SolutionFilter | ||
onSelectedOptionsChanged={onSelectedOptionsChanged} | ||
selectedOptions={[solutions[1].id]} | ||
options={solutions} | ||
/> | ||
); | ||
|
||
userEvent.click(getByTestId('solution-filter-popover-button')); | ||
|
||
await waitForEuiPopoverOpen(); | ||
|
||
userEvent.click(getByTestId(`solution-filter-popover-item-${solutions[1].id}`)); | ||
|
||
expect(onSelectedOptionsChanged).toHaveBeenCalledWith([]); | ||
}); | ||
}); |
Oops, something went wrong.