diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-25 18:12:32 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-25 18:12:32 +0300 |
commit | 7d8d5a3dab415672a41ab29c3bfa9581f275dc50 (patch) | |
tree | 7b9249d8ca8c12ad899b4e6d968193d58e63f458 /spec/frontend/boards | |
parent | 868c8c35fbddd439f4df76a5954e2a1caa2af3cc (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/boards')
12 files changed, 53 insertions, 49 deletions
diff --git a/spec/frontend/boards/board_card_inner_spec.js b/spec/frontend/boards/board_card_inner_spec.js index e0446811f64..6de549718d9 100644 --- a/spec/frontend/boards/board_card_inner_spec.js +++ b/spec/frontend/boards/board_card_inner_spec.js @@ -1,6 +1,7 @@ import { GlLabel, GlLoadingIcon, GlTooltip } from '@gitlab/ui'; import { range } from 'lodash'; import Vuex from 'vuex'; +import { nextTick } from 'vue'; import setWindowLocation from 'helpers/set_window_location_helper'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import { mountExtended } from 'helpers/vue_test_utils_helper'; @@ -261,7 +262,7 @@ describe('Board card component', () => { ], }); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find('.board-card-assignee img').attributes('src')).toBe( 'test_image_from_avatar_url?width=24', @@ -376,7 +377,7 @@ describe('Board card component', () => { }, }); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find('.board-card-assignee .avatar-counter').text().trim()).toEqual('99+'); }); @@ -399,7 +400,7 @@ describe('Board card component', () => { it('does not render label if label does not have an ID', async () => { wrapper.setProps({ item: { ...issue, labels: [label1, { title: 'closed' }] } }); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.findAll(GlLabel).length).toBe(1); expect(wrapper.text()).not.toContain('closed'); diff --git a/spec/frontend/boards/board_list_spec.js b/spec/frontend/boards/board_list_spec.js index e29c19d6e97..d07173c8411 100644 --- a/spec/frontend/boards/board_list_spec.js +++ b/spec/frontend/boards/board_list_spec.js @@ -1,4 +1,5 @@ import Draggable from 'vuedraggable'; +import { nextTick } from 'vue'; import { DraggableItemTypes } from 'ee_else_ce/boards/constants'; import { useFakeRequestAnimationFrame } from 'helpers/fake_request_animation_frame'; import waitForPromises from 'helpers/wait_for_promises'; @@ -65,14 +66,14 @@ describe('Board list component', () => { it('shows new issue form', async () => { wrapper.vm.toggleForm(); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find('.board-new-issue-form').exists()).toBe(true); }); it('shows new issue form after eventhub event', async () => { eventHub.$emit(`toggle-issue-form-${wrapper.vm.list.id}`); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find('.board-new-issue-form').exists()).toBe(true); }); @@ -86,7 +87,7 @@ describe('Board list component', () => { it('shows count list item', async () => { wrapper.vm.showCount = true; - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find('.board-list-count').exists()).toBe(true); expect(wrapper.find('.board-list-count').text()).toBe('Showing all issues'); @@ -95,7 +96,7 @@ describe('Board list component', () => { it('sets data attribute with invalid id', async () => { wrapper.vm.showCount = true; - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find('.board-list-count').attributes('data-issue-id')).toBe('-1'); }); }); @@ -127,7 +128,7 @@ describe('Board list component', () => { }, }); - await wrapper.vm.$nextTick(); + await nextTick(); expect(findIssueCountLoadingIcon().exists()).toBe(true); }); @@ -139,9 +140,9 @@ describe('Board list component', () => { }, }); - await wrapper.vm.$nextTick(); + await nextTick(); await waitForPromises(); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find('.board-list-count').text()).toBe('Showing 1 of 20 issues'); }); @@ -158,7 +159,7 @@ describe('Board list component', () => { it('sets background to bg-danger-100', async () => { wrapper.setProps({ list: { issuesCount: 4, maxIssueCount: 3 } }); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find('.bg-danger-100').exists()).toBe(true); }); }); diff --git a/spec/frontend/boards/components/board_add_new_column_trigger_spec.js b/spec/frontend/boards/components/board_add_new_column_trigger_spec.js index c35f2463f69..7dd02bf1d35 100644 --- a/spec/frontend/boards/components/board_add_new_column_trigger_spec.js +++ b/spec/frontend/boards/components/board_add_new_column_trigger_spec.js @@ -1,5 +1,5 @@ import { GlButton } from '@gitlab/ui'; -import Vue from 'vue'; +import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; import { mountExtended } from 'helpers/vue_test_utils_helper'; import BoardAddNewColumnTrigger from '~/boards/components/board_add_new_column_trigger.vue'; @@ -49,7 +49,7 @@ describe('BoardAddNewColumnTrigger', () => { it('shows the tooltip', async () => { wrapper.find(GlButton).vm.$emit('click'); - await wrapper.vm.$nextTick(); + await nextTick(); const tooltip = findTooltipText(); diff --git a/spec/frontend/boards/components/board_blocked_icon_spec.js b/spec/frontend/boards/components/board_blocked_icon_spec.js index 7b04942f056..7a5c49bd488 100644 --- a/spec/frontend/boards/components/board_blocked_icon_spec.js +++ b/spec/frontend/boards/components/board_blocked_icon_spec.js @@ -1,6 +1,6 @@ import { GlIcon, GlLink, GlPopover, GlLoadingIcon } from '@gitlab/ui'; import { shallowMount, mount } from '@vue/test-utils'; -import Vue from 'vue'; +import Vue, { nextTick } from 'vue'; import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; @@ -39,7 +39,7 @@ describe('BoardBlockedIcon', () => { const mouseenter = async () => { findGlIcon().vm.$emit('mouseenter'); - await wrapper.vm.$nextTick(); + await nextTick(); await waitForApollo(); }; diff --git a/spec/frontend/boards/components/board_card_spec.js b/spec/frontend/boards/components/board_card_spec.js index 3af173aa18c..aad89cf8261 100644 --- a/spec/frontend/boards/components/board_card_spec.js +++ b/spec/frontend/boards/components/board_card_spec.js @@ -1,6 +1,6 @@ import { GlLabel } from '@gitlab/ui'; import { shallowMount, mount } from '@vue/test-utils'; -import Vue from 'vue'; +import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; import BoardCard from '~/boards/components/board_card.vue'; @@ -65,12 +65,12 @@ describe('Board card', () => { const selectCard = async () => { wrapper.trigger('click'); - await wrapper.vm.$nextTick(); + await nextTick(); }; const multiSelectCard = async () => { wrapper.trigger('click', { ctrlKey: true }); - await wrapper.vm.$nextTick(); + await nextTick(); }; beforeEach(() => { diff --git a/spec/frontend/boards/components/board_list_header_spec.js b/spec/frontend/boards/components/board_list_header_spec.js index 8cc0ad5f30c..14870ec76a2 100644 --- a/spec/frontend/boards/components/board_list_header_spec.js +++ b/spec/frontend/boards/components/board_list_header_spec.js @@ -1,5 +1,5 @@ import { shallowMount } from '@vue/test-utils'; -import Vue from 'vue'; +import Vue, { nextTick } from 'vue'; import VueApollo from 'vue-apollo'; import Vuex from 'vuex'; import createMockApollo from 'helpers/mock_apollo_helper'; @@ -148,7 +148,7 @@ describe('Board List Header Component', () => { findCaret().vm.$emit('click'); - await wrapper.vm.$nextTick(); + await nextTick(); expect(toggleListCollapsedSpy).toHaveBeenCalledTimes(1); }); @@ -156,7 +156,7 @@ describe('Board List Header Component', () => { createComponent({ withLocalStorage: false, currentUserId: 1 }); findCaret().vm.$emit('click'); - await wrapper.vm.$nextTick(); + await nextTick(); expect(updateListSpy).toHaveBeenCalledTimes(1); expect(localStorage.getItem(`${wrapper.vm.uniqueKey}.collapsed`)).toBe(null); @@ -168,7 +168,7 @@ describe('Board List Header Component', () => { }); findCaret().vm.$emit('click'); - await wrapper.vm.$nextTick(); + await nextTick(); expect(updateListSpy).not.toHaveBeenCalled(); expect(localStorage.getItem(`${wrapper.vm.uniqueKey}.collapsed`)).toBe(String(isCollapsed())); diff --git a/spec/frontend/boards/components/board_new_issue_spec.js b/spec/frontend/boards/components/board_new_issue_spec.js index 12bee842c85..08ef119aad8 100644 --- a/spec/frontend/boards/components/board_new_issue_spec.js +++ b/spec/frontend/boards/components/board_new_issue_spec.js @@ -1,5 +1,5 @@ import { shallowMount } from '@vue/test-utils'; -import Vue from 'vue'; +import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; import BoardNewIssue from '~/boards/components/board_new_issue.vue'; import BoardNewItem from '~/boards/components/board_new_item.vue'; @@ -45,7 +45,7 @@ describe('Issue boards new issue form', () => { beforeEach(async () => { wrapper = createComponent(); - await wrapper.vm.$nextTick(); + await nextTick(); }); afterEach(() => { @@ -66,7 +66,7 @@ describe('Issue boards new issue form', () => { it('calls addListNewIssue action when `board-new-item` emits form-submit event', async () => { findBoardNewItem().vm.$emit('form-submit', { title: 'Foo' }); - await wrapper.vm.$nextTick(); + await nextTick(); expect(addListNewIssuesSpy).toHaveBeenCalledWith(expect.any(Object), { list: mockList, issueInput: { @@ -83,7 +83,7 @@ describe('Issue boards new issue form', () => { jest.spyOn(eventHub, '$emit').mockImplementation(); findBoardNewItem().vm.$emit('form-cancel'); - await wrapper.vm.$nextTick(); + await nextTick(); expect(eventHub.$emit).toHaveBeenCalledWith(`toggle-issue-form-${mockList.id}`); }); diff --git a/spec/frontend/boards/components/board_new_item_spec.js b/spec/frontend/boards/components/board_new_item_spec.js index ef83fc925bd..86cebc8a719 100644 --- a/spec/frontend/boards/components/board_new_item_spec.js +++ b/spec/frontend/boards/components/board_new_item_spec.js @@ -1,4 +1,5 @@ import { GlForm, GlFormInput, GlButton } from '@gitlab/ui'; +import { nextTick } from 'vue'; import { mountExtended } from 'helpers/vue_test_utils_helper'; import BoardNewItem from '~/boards/components/board_new_item.vue'; @@ -44,7 +45,7 @@ describe('BoardNewItem', () => { expect(wrapper.findByTestId('create-button').props('disabled')).toBe(true); wrapper.find(GlFormInput).vm.$emit('input', 'hello'); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.findByTestId('create-button').props('disabled')).toBe(false); }); @@ -54,7 +55,7 @@ describe('BoardNewItem', () => { it('disables the Create Issue button', async () => { wrapper.find(GlFormInput).vm.$emit('input', ' '); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.findByTestId('create-button').props('disabled')).toBe(true); }); @@ -124,7 +125,7 @@ describe('BoardNewItem', () => { it('emits `form-cancel` event and clears title value when `reset` is triggered on gl-form', async () => { titleInput().setValue('Foo'); - await wrapper.vm.$nextTick(); + await nextTick(); expect(titleInput().element.value).toBe('Foo'); await glForm().trigger('reset'); diff --git a/spec/frontend/boards/components/board_settings_sidebar_spec.js b/spec/frontend/boards/components/board_settings_sidebar_spec.js index 46dd109ffb1..842c8fd131e 100644 --- a/spec/frontend/boards/components/board_settings_sidebar_spec.js +++ b/spec/frontend/boards/components/board_settings_sidebar_spec.js @@ -1,7 +1,7 @@ import { GlDrawer, GlLabel } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import { MountingPortal } from 'portal-vue'; -import Vue from 'vue'; +import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; import { stubComponent } from 'helpers/stub_component'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; @@ -86,7 +86,7 @@ describe('BoardSettingsSidebar', () => { findDrawer().vm.$emit('close'); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find(GlDrawer).exists()).toBe(false); }); @@ -96,7 +96,7 @@ describe('BoardSettingsSidebar', () => { sidebarEventHub.$emit('sidebar.closeAll'); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find(GlDrawer).exists()).toBe(false); }); diff --git a/spec/frontend/boards/components/sidebar/board_editable_item_spec.js b/spec/frontend/boards/components/sidebar/board_editable_item_spec.js index 12e9a9ba365..0c76c711b3a 100644 --- a/spec/frontend/boards/components/sidebar/board_editable_item_spec.js +++ b/spec/frontend/boards/components/sidebar/board_editable_item_spec.js @@ -1,5 +1,6 @@ import { GlLoadingIcon } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; +import { nextTick } from 'vue'; import BoardSidebarItem from '~/boards/components/sidebar/board_editable_item.vue'; describe('boards sidebar remove issue', () => { @@ -79,17 +80,16 @@ describe('boards sidebar remove issue', () => { createComponent({ canUpdate: true, slots }); findEditButton().vm.$emit('click'); - return wrapper.vm.$nextTick().then(() => { - expect(findCollapsed().isVisible()).toBe(false); - expect(findExpanded().isVisible()).toBe(true); - }); + await nextTick(); + expect(findCollapsed().isVisible()).toBe(false); + expect(findExpanded().isVisible()).toBe(true); }); it('hides the header while editing if `toggleHeader` is true', async () => { createComponent({ canUpdate: true, props: { toggleHeader: true } }); findEditButton().vm.$emit('click'); - await wrapper.vm.$nextTick(); + await nextTick(); expect(findEditButton().isVisible()).toBe(false); expect(findTitle().isVisible()).toBe(false); @@ -101,14 +101,14 @@ describe('boards sidebar remove issue', () => { beforeEach(async () => { createComponent({ canUpdate: true }); findEditButton().vm.$emit('click'); - await wrapper.vm.$nextTick(); + await nextTick(); }); it('hides expanded section and displays collapsed section', async () => { expect(findExpanded().isVisible()).toBe(true); document.body.click(); - await wrapper.vm.$nextTick(); + await nextTick(); expect(findCollapsed().isVisible()).toBe(true); expect(findExpanded().isVisible()).toBe(false); @@ -117,7 +117,7 @@ describe('boards sidebar remove issue', () => { it('emits events', async () => { document.body.click(); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.emitted().close).toHaveLength(1); expect(wrapper.emitted()['off-click']).toHaveLength(1); @@ -129,7 +129,7 @@ describe('boards sidebar remove issue', () => { findEditButton().vm.$emit('click'); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.emitted().open.length).toBe(1); }); @@ -139,7 +139,7 @@ describe('boards sidebar remove issue', () => { findEditButton().vm.$emit('click'); - await wrapper.vm.$nextTick(); + await nextTick(); wrapper.vm.collapse({ emitEvent: false }); diff --git a/spec/frontend/boards/components/sidebar/board_sidebar_title_spec.js b/spec/frontend/boards/components/sidebar/board_sidebar_title_spec.js index 4a8eda298f2..5364d929c38 100644 --- a/spec/frontend/boards/components/sidebar/board_sidebar_title_spec.js +++ b/spec/frontend/boards/components/sidebar/board_sidebar_title_spec.js @@ -1,5 +1,6 @@ import { GlAlert, GlFormInput, GlForm } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; +import { nextTick } from 'vue'; import BoardEditableItem from '~/boards/components/sidebar/board_editable_item.vue'; import BoardSidebarTitle from '~/boards/components/sidebar/board_sidebar_title.vue'; import { createStore } from '~/boards/stores'; @@ -75,7 +76,7 @@ describe('~/boards/components/sidebar/board_sidebar_title.vue', () => { }); findFormInput().vm.$emit('input', TEST_TITLE); findForm().vm.$emit('submit', { preventDefault: () => {} }); - await wrapper.vm.$nextTick(); + await nextTick(); }); it('collapses sidebar and renders new title', () => { @@ -98,7 +99,7 @@ describe('~/boards/components/sidebar/board_sidebar_title.vue', () => { jest.spyOn(wrapper.vm, 'setActiveItemTitle').mockImplementation(() => {}); findFormInput().vm.$emit('input', ''); findForm().vm.$emit('submit', { preventDefault: () => {} }); - await wrapper.vm.$nextTick(); + await nextTick(); }); it('commits change to the server', () => { @@ -113,7 +114,7 @@ describe('~/boards/components/sidebar/board_sidebar_title.vue', () => { wrapper.vm.$refs.sidebarItem.expand(); findFormInput().vm.$emit('input', TEST_TITLE); findEditableItem().vm.$emit('off-click'); - await wrapper.vm.$nextTick(); + await nextTick(); }); it('does not collapses sidebar and shows alert', () => { @@ -148,7 +149,7 @@ describe('~/boards/components/sidebar/board_sidebar_title.vue', () => { }); findFormInput().vm.$emit('input', TEST_TITLE); findCancelButton().vm.$emit('click'); - await wrapper.vm.$nextTick(); + await nextTick(); }); it('collapses sidebar and render former title', () => { @@ -168,7 +169,7 @@ describe('~/boards/components/sidebar/board_sidebar_title.vue', () => { jest.spyOn(wrapper.vm, 'setError').mockImplementation(() => {}); findFormInput().vm.$emit('input', 'Invalid title'); findForm().vm.$emit('submit', { preventDefault: () => {} }); - await wrapper.vm.$nextTick(); + await nextTick(); }); it('collapses sidebar and renders former item title', () => { diff --git a/spec/frontend/boards/project_select_spec.js b/spec/frontend/boards/project_select_spec.js index de823094630..05dc7d28eaa 100644 --- a/spec/frontend/boards/project_select_spec.js +++ b/spec/frontend/boards/project_select_spec.js @@ -1,6 +1,6 @@ import { GlDropdown, GlDropdownItem, GlSearchBoxByType, GlLoadingIcon } from '@gitlab/ui'; import { mount } from '@vue/test-utils'; -import Vue from 'vue'; +import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; import ProjectSelect from '~/boards/components/project_select.vue'; import defaultState from '~/boards/stores/state'; @@ -88,7 +88,7 @@ describe('ProjectSelect component', () => { expect(findGlDropdownLoadingIcon().exists()).toBe(true); - await wrapper.vm.$nextTick(); + await nextTick(); expect(findGlDropdownLoadingIcon().exists()).toBe(false); }); |