Skip to content

Commit

Permalink
fix quick edit button tests
Browse files Browse the repository at this point in the history
  • Loading branch information
guskovaue committed Nov 21, 2022
1 parent 0d9990e commit 222d8e0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ describe('rule_quick_edit_buttons', () => {
selectedItems={[mockRule]}
onPerformingAction={() => {}}
onActionPerformed={() => {}}
onEnable={async () => {}}
onDisable={async () => {}}
setRulesToDelete={() => {}}
setRulesToDeleteFilter={() => {}}
setRulesToUpdateAPIKey={() => {}}
Expand All @@ -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();
Expand All @@ -85,6 +87,8 @@ describe('rule_quick_edit_buttons', () => {
selectedItems={[mockRule]}
onPerformingAction={() => {}}
onActionPerformed={() => {}}
onEnable={async () => {}}
onDisable={async () => {}}
setRulesToDelete={() => {}}
setRulesToDeleteFilter={() => {}}
setRulesToUpdateAPIKey={() => {}}
Expand All @@ -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 () => {
Expand All @@ -117,6 +121,8 @@ describe('rule_quick_edit_buttons', () => {
selectedItems={[mockRule]}
onPerformingAction={() => {}}
onActionPerformed={() => {}}
onEnable={async () => {}}
onDisable={async () => {}}
setRulesToDelete={() => {}}
setRulesToDeleteFilter={() => {}}
setRulesToUpdateAPIKey={() => {}}
Expand All @@ -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();
Expand All @@ -159,6 +165,8 @@ describe('rule_quick_edit_buttons', () => {
selectedItems={[mockRule]}
onPerformingAction={() => {}}
onActionPerformed={() => {}}
onEnable={async () => {}}
onDisable={async () => {}}
setRulesToDelete={() => {}}
setRulesToDeleteFilter={() => {}}
setRulesToSnooze={setRulesToSnooze}
Expand Down Expand Up @@ -210,6 +218,8 @@ describe('rule_quick_edit_buttons', () => {
selectedItems={[mockRule]}
onPerformingAction={() => {}}
onActionPerformed={() => {}}
onEnable={async () => {}}
onDisable={async () => {}}
setRulesToDelete={() => {}}
setRulesToDeleteFilter={() => {}}
setRulesToSnooze={setRulesToSnooze}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export const RuleQuickEditButtons: React.FunctionComponent<ComponentOpts> = ({
onClick={onEnable}
isLoading={isEnablingRules}
isDisabled={isPerformingAction || hasDisabledByLicenseRuleTypes}
data-test-subj="enableAll"
data-test-subj="bulkEnable"
>
<FormattedMessage
id="xpack.triggersActionsUI.sections.rulesList.bulkActionPopover.enableAllTitle"
Expand All @@ -308,7 +308,7 @@ export const RuleQuickEditButtons: React.FunctionComponent<ComponentOpts> = ({
onClick={onDisable}
isLoading={isDisablingRules}
isDisabled={isPerformingAction || hasDisabledByLicenseRuleTypes}
data-test-subj="disableAll"
data-test-subj="bulkDisable"
>
<FormattedMessage
id="xpack.triggersActionsUI.sections.rulesList.bulkActionPopover.disableAllTitle"
Expand Down

0 comments on commit 222d8e0

Please sign in to comment.