mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
* [Cases] [108671] Fix faulty status api call, if selection is same * Add unit test to ensure selecting same status message does not call api Co-authored-by: Kristof-Pierre Cummings <kristofpierre.cummings@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kristof C <kpac.ja@gmail.com> Co-authored-by: Kristof-Pierre Cummings <kristofpierre.cummings@elastic.co>
This commit is contained in:
parent
b040096beb
commit
f776be5e61
2 changed files with 15 additions and 2 deletions
|
@ -60,4 +60,15 @@ describe('SyncAlertsSwitch', () => {
|
|||
|
||||
expect(onStatusChanged).toHaveBeenCalledWith('in-progress');
|
||||
});
|
||||
|
||||
it('it does not call onStatusChanged if selection is same as current status', async () => {
|
||||
const wrapper = mount(
|
||||
<StatusContextMenu currentStatus={CaseStatuses.open} onStatusChanged={onStatusChanged} />
|
||||
);
|
||||
|
||||
wrapper.find(`[data-test-subj="case-view-status-dropdown"] button`).simulate('click');
|
||||
wrapper.find(`[data-test-subj="case-view-status-dropdown-open"] button`).simulate('click');
|
||||
|
||||
expect(onStatusChanged).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -33,9 +33,11 @@ const StatusContextMenuComponent: React.FC<Props> = ({
|
|||
const onContextMenuItemClick = useCallback(
|
||||
(status: CaseStatuses) => {
|
||||
closePopover();
|
||||
onStatusChanged(status);
|
||||
if (currentStatus !== status) {
|
||||
onStatusChanged(status);
|
||||
}
|
||||
},
|
||||
[closePopover, onStatusChanged]
|
||||
[closePopover, currentStatus, onStatusChanged]
|
||||
);
|
||||
|
||||
const panelItems = useMemo(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue