diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.test.tsx index 59876bd48b459..928feb0aa900f 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.test.tsx @@ -555,6 +555,35 @@ describe('rules_list component with props', () => { await setup(); expect(wrapper.find('ActionTypeFilter')).toHaveLength(1); }); + + it('filters when the action type filter is changed', async () => { + wrapper = mountWithIntl(); + await act(async () => { + await nextTick(); + wrapper.update(); + }); + (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => true); + loadRulesWithKueryFilter.mockReset(); + await setup(); + + wrapper.find(`[data-test-subj="actionTypeFilterButton"]`).first().simulate('click'); + await act(async () => { + await nextTick(); + wrapper.update(); + }); + wrapper.find(`[data-test-subj="actionTypetestFilterOption"]`).first().simulate('click'); + expect( + wrapper.find('[data-test-subj="actionTypetestFilterOption"] EuiIcon[type="check"]').exists() + ).toBeTruthy(); // tick icon is being shown + expect( + wrapper + .find('[data-test-subj="actionTypetest2FilterOption"] EuiIcon[type="empty"]') + .exists() + ).toBeTruthy(); // doesnt have a tick icon + expect( + wrapper.find('[data-test-subj="actionTypeFilterButton"] .euiNotificationBadge').text() + ).toEqual('1'); // badge is being shown + }); }); describe('showCreateRuleButton prop', () => { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.tsx index ae7b2dc8b437e..791bfa5e76574 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.tsx @@ -644,7 +644,7 @@ export const RulesList = ({ key="action-type-filter" actionTypes={actionTypes} onChange={setActionTypesFilter} - filters={typesFilter} + filters={actionTypesFilter} /> ), ...getRuleOutcomeOrStatusFilter(),