diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-26 12:10:05 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-26 12:10:05 +0300 |
commit | 6f22c85c38b7a896178879172f4c0f82353308f8 (patch) | |
tree | 7b03dd7282e3b05f9ee8c78c50f52bec97bfc450 /spec/frontend/super_sidebar | |
parent | 8759459c84757589002830279dfe3872ffc852bd (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/super_sidebar')
-rw-r--r-- | spec/frontend/super_sidebar/components/global_search/components/global_search_spec.js | 20 | ||||
-rw-r--r-- | spec/frontend/super_sidebar/components/user_bar_spec.js | 16 |
2 files changed, 35 insertions, 1 deletions
diff --git a/spec/frontend/super_sidebar/components/global_search/components/global_search_spec.js b/spec/frontend/super_sidebar/components/global_search/components/global_search_spec.js index eb8801f68c6..f78e141afad 100644 --- a/spec/frontend/super_sidebar/components/global_search/components/global_search_spec.js +++ b/spec/frontend/super_sidebar/components/global_search/components/global_search_spec.js @@ -1,4 +1,4 @@ -import { GlSearchBoxByType, GlToken, GlIcon } from '@gitlab/ui'; +import { GlModal, GlSearchBoxByType, GlToken, GlIcon } from '@gitlab/ui'; import Vue from 'vue'; import Vuex from 'vuex'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; @@ -87,6 +87,8 @@ describe('GlobalSearchModal', () => { ); }; + const findGlobalSearchModal = () => wrapper.findComponent(GlModal); + const findGlobalSearchForm = () => wrapper.findByTestId('global-search-form'); const findGlobalSearchInput = () => wrapper.findComponent(GlSearchBoxByType); const findScopeToken = () => wrapper.findComponent(GlToken); @@ -350,5 +352,21 @@ describe('GlobalSearchModal', () => { }); }); }); + + describe('Modal events', () => { + beforeEach(() => { + createComponent(); + }); + + it('should emit `shown` event when modal shown`', () => { + findGlobalSearchModal().vm.$emit('shown'); + expect(wrapper.emitted('shown')).toHaveLength(1); + }); + + it('should emit `hidden` event when modal hidden`', () => { + findGlobalSearchModal().vm.$emit('hidden'); + expect(wrapper.emitted('hidden')).toHaveLength(1); + }); + }); }); }); diff --git a/spec/frontend/super_sidebar/components/user_bar_spec.js b/spec/frontend/super_sidebar/components/user_bar_spec.js index 2b75fb27972..7abd64ca108 100644 --- a/spec/frontend/super_sidebar/components/user_bar_spec.js +++ b/spec/frontend/super_sidebar/components/user_bar_spec.js @@ -173,6 +173,22 @@ describe('UserBar component', () => { it('should render search modal', () => { expect(findSearchModal().exists()).toBe(true); }); + + describe('Search tooltip', () => { + it('should hide search tooltip when modal is shown', async () => { + findSearchModal().vm.$emit('shown'); + await nextTick(); + const tooltip = getBinding(findSearchButton().element, 'gl-tooltip'); + expect(tooltip.value).toBe(''); + }); + + it('should add search tooltip when modal is hidden', async () => { + findSearchModal().vm.$emit('hidden'); + await nextTick(); + const tooltip = getBinding(findSearchButton().element, 'gl-tooltip'); + expect(tooltip.value).toBe(`Search GitLab <kbd>/</kbd>`); + }); + }); }); describe('While impersonating a user', () => { |