Fix vue/custom-event-name-casing offenses in recent searches

MR 22 of the 583560 loop.

What

Renames the two events of the recent searches dropdown in the legacy filtered search.

Old event New event Emitter Listener
recentSearchesItemSelected recent-searches-item-selected recent_searches_dropdown_content.vue filtered_search_manager.js
requestClearRecentSearches request-clear-recent-searches recent_searches_dropdown_content.vue recent_searches_root.js

The wrapper identifiers, for example onrecentSearchesItemSelectedWrapper, keep their names. They are JavaScript identifiers and not event strings.

The spec also had a stale teardown that called $off('requestClearRecentSearchesSpy', ...), so it removed nothing. It now uses the real event name.

Verification

  • jest: 4 suites pass, 56 tests pass.
  • ESLint on the changed files: no offenses. Prettier reports no change.
  • recent_searches_dropdown_content.vue leaves the vue/custom-event-name-casing list. The todo diff has one removal and no additions.

Verification video

Recorded on /dashboard/merge_requests/search, which still renders the legacy filtered search bar. Two searches are run first, so the dropdown has entries. The filtered search hub is instrumented in the browser, so the overlay lists the listener keys and the emits of the running app.

  1. This branch. The hub registers recent-searches-item-selected and request-clear-recent-searches. Selecting the entry "roadmap" fills the search box and runs the search. Selecting "Clear recent searches" empties the dropdown and leaves [] in local storage.
  2. Control. The same build, with the two $on calls in filtered_search_manager.js and recent_searches_root.js renamed to -BROKEN names. The dropdown still emits both events, but the search box stays empty and the two entries stay in the dropdown and in local storage.

Note for reviewers: the video is recorded with the GDK on Vue 2. On Vue 3 this dropdown never lists any entry, on master as well as on this branch. That is a separate defect and it is reported in !251466 (closed).

Edited by Jorge Tomás

Merge request reports

Loading
Loading