From 222d8e08538320818128ca723fe872bed512942a Mon Sep 17 00:00:00 2001 From: Julia Guskova Date: Mon, 21 Nov 2022 21:46:39 +0100 Subject: [PATCH] fix quick edit button tests --- .../rule_quick_edit_buttons.test.tsx | 20 ++++++++++++++----- .../components/rule_quick_edit_buttons.tsx | 4 ++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/rule_quick_edit_buttons.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/rule_quick_edit_buttons.test.tsx index 510f74dfa66cf..a1a41d0a87186 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/rule_quick_edit_buttons.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/rule_quick_edit_buttons.test.tsx @@ -47,6 +47,8 @@ describe('rule_quick_edit_buttons', () => { selectedItems={[mockRule]} onPerformingAction={() => {}} onActionPerformed={() => {}} + onEnable={async () => {}} + onDisable={async () => {}} setRulesToDelete={() => {}} setRulesToDeleteFilter={() => {}} setRulesToUpdateAPIKey={() => {}} @@ -62,8 +64,8 @@ describe('rule_quick_edit_buttons', () => { /> ); - expect(wrapper.find('[data-test-subj="enableAll"]').exists()).toBeFalsy(); - expect(wrapper.find('[data-test-subj="disableAll"]').exists()).toBeTruthy(); + expect(wrapper.find('[data-test-subj="bulkEnable"]').exists()).toBeTruthy(); + expect(wrapper.find('[data-test-subj="bulkDisable"]').exists()).toBeTruthy(); expect(wrapper.find('[data-test-subj="updateAPIKeys"]').exists()).toBeTruthy(); expect(wrapper.find('[data-test-subj="bulkDelete"]').exists()).toBeTruthy(); expect(wrapper.find('[data-test-subj="bulkSnooze"]').exists()).toBeTruthy(); @@ -85,6 +87,8 @@ describe('rule_quick_edit_buttons', () => { selectedItems={[mockRule]} onPerformingAction={() => {}} onActionPerformed={() => {}} + onEnable={async () => {}} + onDisable={async () => {}} setRulesToDelete={() => {}} setRulesToDeleteFilter={() => {}} setRulesToUpdateAPIKey={() => {}} @@ -100,8 +104,8 @@ describe('rule_quick_edit_buttons', () => { /> ); - expect(wrapper.find('[data-test-subj="enableAll"]').exists()).toBeTruthy(); - expect(wrapper.find('[data-test-subj="disableAll"]').exists()).toBeFalsy(); + expect(wrapper.find('[data-test-subj="bulkEnable"]').exists()).toBeTruthy(); + expect(wrapper.find('[data-test-subj="bulkDisable"]').exists()).toBeTruthy(); }); it('disables the disable/enable/delete bulk actions if in select all mode', async () => { @@ -117,6 +121,8 @@ describe('rule_quick_edit_buttons', () => { selectedItems={[mockRule]} onPerformingAction={() => {}} onActionPerformed={() => {}} + onEnable={async () => {}} + onDisable={async () => {}} setRulesToDelete={() => {}} setRulesToDeleteFilter={() => {}} setRulesToUpdateAPIKey={() => {}} @@ -132,7 +138,7 @@ describe('rule_quick_edit_buttons', () => { /> ); - expect(wrapper.find('[data-test-subj="disableAll"]').first().prop('isDisabled')).toBeTruthy(); + expect(wrapper.find('[data-test-subj="bulkEnable"]').first().prop('isDisabled')).toBeFalsy(); expect(wrapper.find('[data-test-subj="bulkDelete"]').first().prop('isDisabled')).toBeFalsy(); expect(wrapper.find('[data-test-subj="updateAPIKeys"]').first().prop('isDisabled')).toBeFalsy(); expect(wrapper.find('[data-test-subj="bulkSnooze"]').first().prop('isDisabled')).toBeFalsy(); @@ -159,6 +165,8 @@ describe('rule_quick_edit_buttons', () => { selectedItems={[mockRule]} onPerformingAction={() => {}} onActionPerformed={() => {}} + onEnable={async () => {}} + onDisable={async () => {}} setRulesToDelete={() => {}} setRulesToDeleteFilter={() => {}} setRulesToSnooze={setRulesToSnooze} @@ -210,6 +218,8 @@ describe('rule_quick_edit_buttons', () => { selectedItems={[mockRule]} onPerformingAction={() => {}} onActionPerformed={() => {}} + onEnable={async () => {}} + onDisable={async () => {}} setRulesToDelete={() => {}} setRulesToDeleteFilter={() => {}} setRulesToSnooze={setRulesToSnooze} diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/rule_quick_edit_buttons.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/rule_quick_edit_buttons.tsx index 7136e6f5483c9..f454ed78116b9 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/rule_quick_edit_buttons.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/rule_quick_edit_buttons.tsx @@ -295,7 +295,7 @@ export const RuleQuickEditButtons: React.FunctionComponent = ({ onClick={onEnable} isLoading={isEnablingRules} isDisabled={isPerformingAction || hasDisabledByLicenseRuleTypes} - data-test-subj="enableAll" + data-test-subj="bulkEnable" > = ({ onClick={onDisable} isLoading={isDisablingRules} isDisabled={isPerformingAction || hasDisabledByLicenseRuleTypes} - data-test-subj="disableAll" + data-test-subj="bulkDisable" >