diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-28 18:10:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-28 18:10:08 +0300 |
commit | f7f0c0502763777f48964774a87b0a34dfb1d9ab (patch) | |
tree | 777821671f0eba38eadd5f60da96a1e54870350a /spec/frontend/boards/project_select_spec.js | |
parent | 10cb807543dca60b59a380100d1b70730d0e8b29 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/boards/project_select_spec.js')
-rw-r--r-- | spec/frontend/boards/project_select_spec.js | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/spec/frontend/boards/project_select_spec.js b/spec/frontend/boards/project_select_spec.js index 05dc7d28eaa..7206fb83212 100644 --- a/spec/frontend/boards/project_select_spec.js +++ b/spec/frontend/boards/project_select_spec.js @@ -1,4 +1,10 @@ -import { GlDropdown, GlDropdownItem, GlSearchBoxByType, GlLoadingIcon } from '@gitlab/ui'; +import { + GlDropdown, + GlDropdownItem, + GlSearchBoxByType, + GlLoadingIcon, + GlFormInput, +} from '@gitlab/ui'; import { mount } from '@vue/test-utils'; import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; @@ -23,6 +29,8 @@ describe('ProjectSelect component', () => { const findInMenuLoadingIcon = () => wrapper.find("[data-testid='dropdown-text-loading-icon']"); const findEmptySearchMessage = () => wrapper.find("[data-testid='empty-result-message']"); + const waitRAF = () => new Promise((resolve) => requestAnimationFrame(resolve)); + const createStore = ({ state, activeGroupProjects }) => { Vue.use(Vuex); @@ -61,6 +69,7 @@ describe('ProjectSelect component', () => { provide: { groupId: 1, }, + attachTo: document.body, }); }; @@ -120,6 +129,17 @@ describe('ProjectSelect component', () => { it('does not render empty search result message', () => { expect(findEmptySearchMessage().exists()).toBe(false); }); + + it('focuses on the search input', async () => { + const dropdownToggle = findGlDropdown().find('.dropdown-toggle'); + + await dropdownToggle.trigger('click'); + await waitRAF(); + await nextTick(); + + const searchInput = findGlDropdown().findComponent(GlFormInput).element; + expect(document.activeElement).toEqual(searchInput); + }); }); describe('when no projects are being returned', () => { |