Skip to content

Commit

Permalink
[RAM] Fix broken action type filter in rules list (#145691)
Browse files Browse the repository at this point in the history
## Summary

Closes #145636


https://user-images.githubusercontent.com/17549662/202652963-205d1590-5cdf-4b4c-8f8b-e1133e6c274c.mov

### Checklist

- [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
  • Loading branch information
jcger authored Nov 21, 2022
1 parent 7510086 commit 87c64dd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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(<RulesList />);
await act(async () => {
await nextTick();
wrapper.update();
});
(getIsExperimentalFeatureEnabled as jest.Mock<any, any>).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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ export const RulesList = ({
key="action-type-filter"
actionTypes={actionTypes}
onChange={setActionTypesFilter}
filters={typesFilter}
filters={actionTypesFilter}
/>
),
...getRuleOutcomeOrStatusFilter(),
Expand Down

0 comments on commit 87c64dd

Please sign in to comment.