diff options
Diffstat (limited to 'spec/frontend/search/topbar/components/app_spec.js')
-rw-r--r-- | spec/frontend/search/topbar/components/app_spec.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/spec/frontend/search/topbar/components/app_spec.js b/spec/frontend/search/topbar/components/app_spec.js index 423ec6ff63b..9dc14b97ce0 100644 --- a/spec/frontend/search/topbar/components/app_spec.js +++ b/spec/frontend/search/topbar/components/app_spec.js @@ -3,6 +3,7 @@ import { shallowMount } from '@vue/test-utils'; import Vue from 'vue'; import Vuex from 'vuex'; import { MOCK_QUERY } from 'jest/search/mock_data'; +import { stubComponent } from 'helpers/stub_component'; import GlobalSearchTopbar from '~/search/topbar/components/app.vue'; import GroupFilter from '~/search/topbar/components/group_filter.vue'; import ProjectFilter from '~/search/topbar/components/project_filter.vue'; @@ -93,11 +94,20 @@ describe('GlobalSearchTopbar', () => { }); it('dispatched correct click action', () => { - const draweToggleSpy = jest.fn(); - wrapper.vm.$refs.markdownDrawer.toggleDrawer = draweToggleSpy; + const drawerToggleSpy = jest.fn(); + + createComponent( + { query: { repository_ref: '' } }, + { elasticsearchEnabled: true, defaultBranchName: '' }, + { + MarkdownDrawer: stubComponent(MarkdownDrawer, { + methods: { toggleDrawer: drawerToggleSpy }, + }), + }, + ); findSyntaxOptionButton().vm.$emit('click'); - expect(draweToggleSpy).toHaveBeenCalled(); + expect(drawerToggleSpy).toHaveBeenCalled(); }); }); |