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 forerroronWorkItemTitle, which only emitsupdate-draftandupdate-work-item. Removed both@errorlisteners and the spec test that emittederroron the stub.WorkItemParent(app/assets/javascripts/work_items/components/work_item_parent.vue) listened forresetonWorkItemSidebarDropdownWidget. That widget already reports a reset asupdate-valuewith a null value, whichWorkItemParenthandles through the samehandleItemClickthenupdateParentpath. Removed the@resetlistener and theunassignParentmethod. The two spec tests that emittedresetnow emitupdate-valuewith null, keeping unassign coverage.- Scan result policy
RuleSection(ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_result/rule/rule_section.vue) listened forremoveon its four rule builder children, none of which render a remove button or emit it. The section's own remove button still emitsremove. Removed the four dead listeners and theremoveRulemethod, 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.jsMR 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.