Remove listeners for events child components never emit

What does this MR do and why?

Three parent components listen for events their child components never emit. Specs exercised these dead paths by calling vm.$emit() directly on a stub, which hid the fact that the real component never sends that event. This surfaced while investigating !253493 (closed), which makes stubs carry the real component's emits option so specs can no longer emit undeclared events unnoticed.

Changes:

  • WorkItemDetail (app/assets/javascripts/work_items/components/work_item_detail.vue) listened for error on WorkItemTitle, which only emits update-draft and update-work-item. Removed both @error listeners and the spec test that emitted error on the stub.
  • WorkItemParent (app/assets/javascripts/work_items/components/work_item_parent.vue) listened for reset on WorkItemSidebarDropdownWidget. That widget already reports a reset as update-value with a null value, which WorkItemParent handles through the same handleItemClick then updateParent path. Removed the @reset listener and the unassignParent method. The two spec tests that emitted reset now emit update-value with null, keeping unassign coverage.
  • Scan result policy RuleSection (ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_result/rule/rule_section.vue) listened for remove on its four rule builder children, none of which render a remove button or emit it. The section's own remove button still emits remove. Removed the four dead listeners and the removeRule method, and replaced the parametrised "removing a rule" spec test with one that clicks the section's remove button.

No user-facing behaviour changes.

References

Part of the cleanup work tracked in !253493 (closed). That MR's Vue 3 Jest job is where these dead listeners were found failing once stubs carry real emits.

Screenshots or screen recordings

Not applicable.

How to set up and validate locally

Run the affected specs on both Vue 2 and Vue 3:

yarn jest spec/frontend/work_items/components/work_item_detail_spec.js spec/frontend/work_items/components/work_item_parent_spec.js ee/spec/frontend/security_orchestration/components/policy_editor/scan_result/rule/rule_section_spec.js
VUE_VERSION=3 yarn jest spec/frontend/work_items/components/work_item_detail_spec.js spec/frontend/work_items/components/work_item_parent_spec.js ee/spec/frontend/security_orchestration/components/policy_editor/scan_result/rule/rule_section_spec.js

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading
Loading