diff options
Diffstat (limited to 'spec/frontend/monitoring/components/dashboards_dropdown_spec.js')
-rw-r--r-- | spec/frontend/monitoring/components/dashboards_dropdown_spec.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/spec/frontend/monitoring/components/dashboards_dropdown_spec.js b/spec/frontend/monitoring/components/dashboards_dropdown_spec.js index ef5784183b2..6ed190051ce 100644 --- a/spec/frontend/monitoring/components/dashboards_dropdown_spec.js +++ b/spec/frontend/monitoring/components/dashboards_dropdown_spec.js @@ -1,3 +1,4 @@ +import { nextTick } from 'vue'; import { shallowMount } from '@vue/test-utils'; import { GlDropdownItem, GlIcon } from '@gitlab/ui'; @@ -27,18 +28,17 @@ describe('DashboardsDropdown', () => { ...props, defaultBranch, }, - sync: false, ...storeOpts, ...opts, }); } const findItems = () => wrapper.findAll(GlDropdownItem); - const findItemAt = i => wrapper.findAll(GlDropdownItem).at(i); + const findItemAt = (i) => wrapper.findAll(GlDropdownItem).at(i); const findSearchInput = () => wrapper.find({ ref: 'monitorDashboardsDropdownSearch' }); const findNoItemsMsg = () => wrapper.find({ ref: 'monitorDashboardsDropdownMsg' }); const findStarredListDivider = () => wrapper.find({ ref: 'starredListDivider' }); - const setSearchTerm = searchTerm => wrapper.setData({ searchTerm }); + const setSearchTerm = (searchTerm) => wrapper.setData({ searchTerm }); beforeEach(() => { mockDashboards = dashboardGitResponse; @@ -72,22 +72,20 @@ describe('DashboardsDropdown', () => { expect(findNoItemsMsg().isVisible()).toBe(false); }); - it('filters dropdown items when searched for item exists in the list', () => { + it('filters dropdown items when searched for item exists in the list', async () => { const searchTerm = 'Overview'; setSearchTerm(searchTerm); + await nextTick(); - return wrapper.vm.$nextTick().then(() => { - expect(findItems()).toHaveLength(1); - }); + expect(findItems()).toHaveLength(1); }); - it('shows no items found message when searched for item does not exists in the list', () => { + it('shows no items found message when searched for item does not exists in the list', async () => { const searchTerm = 'does-not-exist'; setSearchTerm(searchTerm); + await nextTick(); - return wrapper.vm.$nextTick().then(() => { - expect(findNoItemsMsg().isVisible()).toBe(true); - }); + expect(findNoItemsMsg().isVisible()).toBe(true); }); }); @@ -105,7 +103,7 @@ describe('DashboardsDropdown', () => { describe('when the dashboard is missing a display name', () => { beforeEach(() => { - mockDashboards = dashboardGitResponse.map(d => ({ ...d, display_name: undefined })); + mockDashboards = dashboardGitResponse.map((d) => ({ ...d, display_name: undefined })); createComponent(); }); |