Commit ff13bd4a authored by Vitaly Slobodin's avatar Vitaly Slobodin Committed by Paul Slaughter

Replace $emit call with single arg in EscalationPolicies

https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64514
parent c1e45452
......@@ -97,7 +97,7 @@ export default {
addRule() {
this.rules.push({ ...cloneDeep(DEFAULT_ESCALATION_RULE), key: uniqueId() });
},
updateEscalationRules(index, rule) {
updateEscalationRules({ rule, index }) {
this.rules[index] = { ...this.rules[index], ...rule };
this.emitRulesUpdate();
},
......
......@@ -113,11 +113,14 @@ export default {
this.emitUpdate();
},
emitUpdate() {
this.$emit('update-escalation-rule', this.index, {
oncallScheduleIid: parseInt(this.oncallScheduleIid, 10),
action: this.action,
status: this.status,
elapsedTimeSeconds: parseInt(this.elapsedTimeSeconds, 10),
this.$emit('update-escalation-rule', {
index: this.index,
rule: {
oncallScheduleIid: parseInt(this.oncallScheduleIid, 10),
action: this.action,
status: this.status,
elapsedTimeSeconds: parseInt(this.elapsedTimeSeconds, 10),
},
});
},
},
......
......@@ -85,7 +85,7 @@ describe('AddEscalationPolicyForm', () => {
elapsedTimeSeconds: 30,
oncallScheduleIid: 2,
};
findRules().at(0).vm.$emit('update-escalation-rule', 0, updatedRule);
findRules().at(0).vm.$emit('update-escalation-rule', { index: 0, rule: updatedRule });
expect(wrapper.emitted('update-escalation-policy-form')[0]).toEqual([
{ field: 'rules', value: [expect.objectContaining(updatedRule)] },
]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment