Stop specs from emitting events components never emit

What does this MR do and why?

Specs were emitting events on stubs (via stubComponent() and shallowMount) that the stubbed component neither declares nor emits. This went unnoticed because stubs did not carry the real component's emits option, so nothing rejected the call. This surfaced while investigating !253493 (closed), which fixes that by making stubs carry the real emits.

Specs switched to the event the component really emits

Spec / stub Was emitting Now emits Why
role_form_spec.js
PermissionsSelector
update:permissions change change is the component's v-model event
create_sync_form_spec.js
ServerFormGroup, GroupCnFormGroup
ldapmain, group1, ldapalt input with that value the value was passed as the event name
kubernetes_overview_spec.js
KubernetesTabs
show-resource-details select-item the parent listens for select-item to open the drawer
dast_site_profiles_list_spec.js
ProfilesList
input delete-profile listener-forwarding test needs an event the list emits
editor_wrapper_spec.js
ScanExecutionPolicyEditor
error error on ScanResultPolicyEditor only the approval (scan result) editor emits error
wizard_spec.js
EmailVerification
set-verification-state same event on PhoneVerification only the phone step emits it

Emits removed because nothing emits or listens for the event

Spec / stub Event What changed
create_work_item_modal_spec.js
CreateWorkItem
cancel test removed; the real event confirm-cancel is already covered
list_spec.js
PersistedSearch
filter-submit emit removed from the doSearch helper
editor_component_spec.js
ActionSection
set-ref two emits removed
mr_widget_ready_to_merge_spec.js
MergeTrainRestartTrainConfirmationDialog
show emit removed

References

The double-fired tracking event found while fixing the frequent items specs is handled separately in !253514 (merged).

Part of the cleanup work tracked in !253493 (closed). That MR's Vue 3 Jest job is where these failures were found.

Screenshots or screen recordings

Not applicable.

How to set up and validate locally

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

yarn jest spec/frontend/work_items/components/create_work_item_modal_spec.js spec/frontend/environments/environment_details/components/kubernetes/kubernetes_overview_spec.js spec/frontend/packages_and_registries/container_registry/explorer/pages/list_spec.js ee/spec/frontend/roles_and_permissions ee/spec/frontend/security_orchestration/components/policy_editor ee/spec/frontend/security_configuration/dast_profiles ee/spec/frontend/users/identity_verification ee/spec/frontend/vue_merge_request_widget/components/states/mr_widget_ready_to_merge_spec.js

Then the same paths with VUE_VERSION=3 set.

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.

Edited by Illya Klymov

Merge request reports

Loading
Loading