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