diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-20 18:07:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-20 18:07:34 +0300 |
commit | 8b61452138ecc511b52cd49be4ee6b8a80390c50 (patch) | |
tree | 122b817432c2a0f0e23767bd95791a89b20540c0 /spec/javascripts/frequent_items | |
parent | f864f8a7aafa45b0e4c04e4312f89da4b1227c0f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/javascripts/frequent_items')
-rw-r--r-- | spec/javascripts/frequent_items/components/frequent_items_search_input_spec.js | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/spec/javascripts/frequent_items/components/frequent_items_search_input_spec.js b/spec/javascripts/frequent_items/components/frequent_items_search_input_spec.js deleted file mode 100644 index be11af8428f..00000000000 --- a/spec/javascripts/frequent_items/components/frequent_items_search_input_spec.js +++ /dev/null @@ -1,83 +0,0 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; -import searchComponent from '~/frequent_items/components/frequent_items_search_input.vue'; -import eventHub from '~/frequent_items/event_hub'; - -const localVue = createLocalVue(); - -const createComponent = (namespace = 'projects') => - shallowMount(localVue.extend(searchComponent), { - propsData: { namespace }, - localVue, - sync: false, - }); - -describe('FrequentItemsSearchInputComponent', () => { - let wrapper; - let vm; - - beforeEach(() => { - wrapper = createComponent(); - - ({ vm } = wrapper); - }); - - afterEach(() => { - vm.$destroy(); - }); - - describe('methods', () => { - describe('setFocus', () => { - it('should set focus to search input', () => { - spyOn(vm.$refs.search, 'focus'); - - vm.setFocus(); - - expect(vm.$refs.search.focus).toHaveBeenCalled(); - }); - }); - }); - - describe('mounted', () => { - it('should listen `dropdownOpen` event', done => { - spyOn(eventHub, '$on'); - const vmX = createComponent().vm; - - localVue.nextTick(() => { - expect(eventHub.$on).toHaveBeenCalledWith( - `${vmX.namespace}-dropdownOpen`, - jasmine.any(Function), - ); - done(); - }); - }); - }); - - describe('beforeDestroy', () => { - it('should unbind event listeners on eventHub', done => { - const vmX = createComponent().vm; - spyOn(eventHub, '$off'); - - vmX.$mount(); - vmX.$destroy(); - - localVue.nextTick(() => { - expect(eventHub.$off).toHaveBeenCalledWith( - `${vmX.namespace}-dropdownOpen`, - jasmine.any(Function), - ); - done(); - }); - }); - }); - - describe('template', () => { - it('should render component element', () => { - expect(wrapper.classes()).toContain('search-input-container'); - expect(wrapper.contains('input.form-control')).toBe(true); - expect(wrapper.contains('.search-icon')).toBe(true); - expect(wrapper.find('input.form-control').attributes('placeholder')).toBe( - 'Search your projects', - ); - }); - }); -}); |