Commit fd4b2a44 authored by Mike Greiling's avatar Mike Greiling

Do not automatically focus on projects search input

parent bfdb161b
......@@ -3,7 +3,6 @@ import { debounce } from 'lodash';
import { mapActions, mapState } from 'vuex';
import { GlIcon } from '@gitlab/ui';
import Tracking from '~/tracking';
import eventHub from '../event_hub';
import frequentItemsMixin from './frequent_items_mixin';
const trackingMixin = Tracking.mixin();
......@@ -32,12 +31,6 @@ export default {
this.setSearchQuery(this.searchQuery);
}, 500),
},
mounted() {
eventHub.$on(`${this.namespace}-dropdownOpen`, this.setFocus);
},
beforeDestroy() {
eventHub.$off(`${this.namespace}-dropdownOpen`, this.setFocus);
},
methods: {
...mapActions(['setSearchQuery']),
setFocus() {
......
......@@ -2,7 +2,6 @@ import { shallowMount } from '@vue/test-utils';
import { mockTracking, unmockTracking } from 'helpers/tracking_helper';
import searchComponent from '~/frequent_items/components/frequent_items_search_input.vue';
import { createStore } from '~/frequent_items/store';
import eventHub from '~/frequent_items/event_hub';
describe('FrequentItemsSearchInputComponent', () => {
let wrapper;
......@@ -45,39 +44,6 @@ describe('FrequentItemsSearchInputComponent', () => {
});
});
describe('mounted', () => {
it('should listen `dropdownOpen` event', (done) => {
jest.spyOn(eventHub, '$on').mockImplementation(() => {});
const vmX = createComponent().vm;
vmX.$nextTick(() => {
expect(eventHub.$on).toHaveBeenCalledWith(
`${vmX.namespace}-dropdownOpen`,
expect.any(Function),
);
done();
});
});
});
describe('beforeDestroy', () => {
it('should unbind event listeners on eventHub', (done) => {
const vmX = createComponent().vm;
jest.spyOn(eventHub, '$off').mockImplementation(() => {});
vmX.$mount();
vmX.$destroy();
vmX.$nextTick(() => {
expect(eventHub.$off).toHaveBeenCalledWith(
`${vmX.namespace}-dropdownOpen`,
expect.any(Function),
);
done();
});
});
});
describe('template', () => {
it('should render component element', () => {
expect(wrapper.classes()).toContain('search-input-container');
......
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