diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-07 18:15:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-07 18:15:03 +0300 |
commit | 3a0f6ebaa9a80e34c09f599a624f6e4520009ef1 (patch) | |
tree | 4560fa6bcba7d950595e906ee3286dd1e44642f1 /spec/frontend | |
parent | 6dd9e3644eea1a5c605a6a623cae1d53b156b9e5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
17 files changed, 30 insertions, 38 deletions
diff --git a/spec/frontend/crm/contacts_root_spec.js b/spec/frontend/crm/contacts_root_spec.js index c7410d13365..18bd2d7c45b 100644 --- a/spec/frontend/crm/contacts_root_spec.js +++ b/spec/frontend/crm/contacts_root_spec.js @@ -122,16 +122,6 @@ describe('Customer relations contacts root app', () => { expect(findError().exists()).toBe(true); }); - - it('should exist when new contact form emits error', async () => { - router.replace({ path: '/new' }); - mountComponent(); - - findNewContactForm().vm.$emit('error'); - await waitForPromises(); - - expect(findError().exists()).toBe(true); - }); }); describe('on successful load', () => { diff --git a/spec/frontend/crm/new_contact_form_spec.js b/spec/frontend/crm/new_contact_form_spec.js index 681c0539536..1497c348676 100644 --- a/spec/frontend/crm/new_contact_form_spec.js +++ b/spec/frontend/crm/new_contact_form_spec.js @@ -1,3 +1,4 @@ +import { GlAlert } from '@gitlab/ui'; import Vue from 'vue'; import VueApollo from 'vue-apollo'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; @@ -21,6 +22,7 @@ describe('Customer relations contacts root app', () => { const findCreateNewContactButton = () => wrapper.findByTestId('create-new-contact-button'); const findCancelButton = () => wrapper.findByTestId('cancel-button'); const findForm = () => wrapper.find('form'); + const findError = () => wrapper.findComponent(GlAlert); const mountComponent = ({ mountFunction = shallowMountExtended } = {}) => { fakeApollo = createMockApollo([[createContactMutation, queryHandler]]); @@ -32,6 +34,7 @@ describe('Customer relations contacts root app', () => { wrapper = mountFunction(NewContactForm, { provide: { groupId: 26, groupFullPath: 'flightjs' }, apolloProvider: fakeApollo, + propsData: { drawerOpen: true }, }); }; @@ -83,26 +86,25 @@ describe('Customer relations contacts root app', () => { }); describe('when query fails', () => { - it('should emit error on reject', async () => { + it('should show error on reject', async () => { queryHandler = jest.fn().mockRejectedValue('ERROR'); mountComponent(); findForm().trigger('submit'); await waitForPromises(); - expect(wrapper.emitted().error).toBeTruthy(); + expect(findError().exists()).toBe(true); }); - it('should emit error on error response', async () => { + it('should show error on error response', async () => { queryHandler = jest.fn().mockResolvedValue(createContactMutationErrorResponse); mountComponent(); findForm().trigger('submit'); await waitForPromises(); - expect(wrapper.emitted().error[0][0]).toEqual( - createContactMutationErrorResponse.data.customerRelationsContactCreate.errors, - ); + expect(findError().exists()).toBe(true); + expect(findError().text()).toBe('Phone is invalid.'); }); }); }); diff --git a/spec/frontend/issuable_bulk_update_sidebar/components/status_select_spec.js b/spec/frontend/issuable/bulk_update_sidebar/components/status_select_spec.js index 09dcb963154..8ecbf41ce56 100644 --- a/spec/frontend/issuable_bulk_update_sidebar/components/status_select_spec.js +++ b/spec/frontend/issuable/bulk_update_sidebar/components/status_select_spec.js @@ -1,7 +1,7 @@ import { GlDropdown, GlDropdownItem } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; -import StatusSelect from '~/issuable_bulk_update_sidebar/components/status_select.vue'; -import { ISSUE_STATUS_SELECT_OPTIONS } from '~/issuable_bulk_update_sidebar/constants'; +import StatusSelect from '~/issuable/bulk_update_sidebar/components/status_select.vue'; +import { ISSUE_STATUS_SELECT_OPTIONS } from '~/issuable/bulk_update_sidebar/constants'; describe('StatusSelect', () => { let wrapper; diff --git a/spec/frontend/issuable_form_spec.js b/spec/frontend/issuable/issuable_form_spec.js index c77fde4261e..321c61ead1e 100644 --- a/spec/frontend/issuable_form_spec.js +++ b/spec/frontend/issuable/issuable_form_spec.js @@ -1,6 +1,6 @@ import $ from 'jquery'; -import IssuableForm from '~/issuable_form'; +import IssuableForm from '~/issuable/issuable_form'; function createIssuable() { const instance = new IssuableForm($(document.createElement('form'))); diff --git a/spec/frontend/issuable_spec.js b/spec/frontend/issuable/issuable_spec.js index e0bd7b802c9..7115861bb51 100644 --- a/spec/frontend/issuable_spec.js +++ b/spec/frontend/issuable/issuable_spec.js @@ -1,5 +1,5 @@ -import issuableInitBulkUpdateSidebar from '~/issuable_bulk_update_sidebar/issuable_init_bulk_update_sidebar'; -import IssuableIndex from '~/issuable_index'; +import issuableInitBulkUpdateSidebar from '~/issuable/bulk_update_sidebar/issuable_init_bulk_update_sidebar'; +import IssuableIndex from '~/issuable/issuable_index'; describe('Issuable', () => { describe('initBulkUpdate', () => { diff --git a/spec/frontend/issues/show/components/header_actions_spec.js b/spec/frontend/issues/show/components/header_actions_spec.js index 9556d54104f..7d39f342f27 100644 --- a/spec/frontend/issues/show/components/header_actions_spec.js +++ b/spec/frontend/issues/show/components/header_actions_spec.js @@ -2,7 +2,7 @@ import { GlButton, GlDropdown, GlDropdownItem, GlLink, GlModal } from '@gitlab/u import { createLocalVue, shallowMount } from '@vue/test-utils'; import Vuex from 'vuex'; import createFlash, { FLASH_TYPES } from '~/flash'; -import { IssuableType } from '~/issuable_show/constants'; +import { IssuableType } from '~/vue_shared/issuable/show/constants'; import HeaderActions from '~/issues/show/components/header_actions.vue'; import { IssuableStatus, IssueStateEvent } from '~/issues/show/constants'; import promoteToEpicMutation from '~/issues/show/queries/promote_to_epic.mutation.graphql'; diff --git a/spec/frontend/delete_label_modal_spec.js b/spec/frontend/labels/delete_label_modal_spec.js index 0b3e6fe652a..7d3b58078b0 100644 --- a/spec/frontend/delete_label_modal_spec.js +++ b/spec/frontend/labels/delete_label_modal_spec.js @@ -1,5 +1,5 @@ import { TEST_HOST } from 'helpers/test_constants'; -import initDeleteLabelModal from '~/delete_label_modal'; +import initDeleteLabelModal from '~/labels/delete_label_modal'; describe('DeleteLabelModal', () => { const buttons = [ diff --git a/spec/frontend/labels_select_spec.js b/spec/frontend/labels/labels_select_spec.js index cbc9a923f8b..f6e280564cc 100644 --- a/spec/frontend/labels_select_spec.js +++ b/spec/frontend/labels/labels_select_spec.js @@ -1,5 +1,5 @@ import $ from 'jquery'; -import LabelsSelect from '~/labels_select'; +import LabelsSelect from '~/labels/labels_select'; const mockUrl = '/foo/bar/url'; diff --git a/spec/frontend/packages_and_registries/infrastructure_registry/components/shared/__snapshots__/package_list_row_spec.js.snap b/spec/frontend/packages_and_registries/infrastructure_registry/components/shared/__snapshots__/package_list_row_spec.js.snap index 7e3ff734981..67c3b8b795a 100644 --- a/spec/frontend/packages_and_registries/infrastructure_registry/components/shared/__snapshots__/package_list_row_spec.js.snap +++ b/spec/frontend/packages_and_registries/infrastructure_registry/components/shared/__snapshots__/package_list_row_spec.js.snap @@ -86,7 +86,7 @@ exports[`packages_list_row renders 1`] = ` </div> <div - class="gl-w-9 gl-display-none gl-sm-display-flex gl-justify-content-end gl-pr-1" + class="gl-w-9 gl-display-flex gl-justify-content-end gl-pr-1" > <gl-button-stub aria-label="Remove package" diff --git a/spec/frontend/packages_and_registries/package_registry/components/list/__snapshots__/package_list_row_spec.js.snap b/spec/frontend/packages_and_registries/package_registry/components/list/__snapshots__/package_list_row_spec.js.snap index 9c40b85e025..165ee962417 100644 --- a/spec/frontend/packages_and_registries/package_registry/components/list/__snapshots__/package_list_row_spec.js.snap +++ b/spec/frontend/packages_and_registries/package_registry/components/list/__snapshots__/package_list_row_spec.js.snap @@ -92,7 +92,7 @@ exports[`packages_list_row renders 1`] = ` </div> <div - class="gl-w-9 gl-display-none gl-sm-display-flex gl-justify-content-end gl-pr-1" + class="gl-w-9 gl-display-flex gl-justify-content-end gl-pr-1" > <gl-button-stub aria-label="Remove package" diff --git a/spec/frontend/issuable_show/components/issuable_body_spec.js b/spec/frontend/vue_shared/issuable/show/components/issuable_body_spec.js index 6fa298ca3f2..41bacf18a68 100644 --- a/spec/frontend/issuable_show/components/issuable_body_spec.js +++ b/spec/frontend/vue_shared/issuable/show/components/issuable_body_spec.js @@ -1,11 +1,11 @@ import { shallowMount } from '@vue/test-utils'; import { useFakeDate } from 'helpers/fake_date'; -import IssuableBody from '~/issuable_show/components/issuable_body.vue'; +import IssuableBody from '~/vue_shared/issuable/show/components/issuable_body.vue'; -import IssuableDescription from '~/issuable_show/components/issuable_description.vue'; -import IssuableEditForm from '~/issuable_show/components/issuable_edit_form.vue'; -import IssuableTitle from '~/issuable_show/components/issuable_title.vue'; +import IssuableDescription from '~/vue_shared/issuable/show/components/issuable_description.vue'; +import IssuableEditForm from '~/vue_shared/issuable/show/components/issuable_edit_form.vue'; +import IssuableTitle from '~/vue_shared/issuable/show/components/issuable_title.vue'; import TaskList from '~/task_list'; import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; diff --git a/spec/frontend/issuable_show/components/issuable_description_spec.js b/spec/frontend/vue_shared/issuable/show/components/issuable_description_spec.js index 1058e5decfd..f2211e5b2bb 100644 --- a/spec/frontend/issuable_show/components/issuable_description_spec.js +++ b/spec/frontend/vue_shared/issuable/show/components/issuable_description_spec.js @@ -1,7 +1,7 @@ import { shallowMount } from '@vue/test-utils'; import $ from 'jquery'; -import IssuableDescription from '~/issuable_show/components/issuable_description.vue'; +import IssuableDescription from '~/vue_shared/issuable/show/components/issuable_description.vue'; import { mockIssuable } from '../mock_data'; diff --git a/spec/frontend/issuable_show/components/issuable_edit_form_spec.js b/spec/frontend/vue_shared/issuable/show/components/issuable_edit_form_spec.js index 184c9fe251c..051ffd27af4 100644 --- a/spec/frontend/issuable_show/components/issuable_edit_form_spec.js +++ b/spec/frontend/vue_shared/issuable/show/components/issuable_edit_form_spec.js @@ -1,8 +1,8 @@ import { GlFormInput } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; -import IssuableEditForm from '~/issuable_show/components/issuable_edit_form.vue'; -import IssuableEventHub from '~/issuable_show/event_hub'; +import IssuableEditForm from '~/vue_shared/issuable/show/components/issuable_edit_form.vue'; +import IssuableEventHub from '~/vue_shared/issuable/show/event_hub'; import MarkdownField from '~/vue_shared/components/markdown/field.vue'; import { mockIssuableShowProps, mockIssuable } from '../mock_data'; diff --git a/spec/frontend/issuable_show/components/issuable_header_spec.js b/spec/frontend/vue_shared/issuable/show/components/issuable_header_spec.js index b85f2dd1999..41735923957 100644 --- a/spec/frontend/issuable_show/components/issuable_header_spec.js +++ b/spec/frontend/vue_shared/issuable/show/components/issuable_header_spec.js @@ -2,7 +2,7 @@ import { GlIcon, GlAvatarLabeled } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; -import IssuableHeader from '~/issuable_show/components/issuable_header.vue'; +import IssuableHeader from '~/vue_shared/issuable/show/components/issuable_header.vue'; import { mockIssuableShowProps, mockIssuable } from '../mock_data'; diff --git a/spec/frontend/issuable_show/components/issuable_show_root_spec.js b/spec/frontend/vue_shared/issuable/show/components/issuable_show_root_spec.js index 4308ee02ac8..d1eb1366225 100644 --- a/spec/frontend/issuable_show/components/issuable_show_root_spec.js +++ b/spec/frontend/vue_shared/issuable/show/components/issuable_show_root_spec.js @@ -1,8 +1,8 @@ import { shallowMount } from '@vue/test-utils'; -import IssuableBody from '~/issuable_show/components/issuable_body.vue'; -import IssuableHeader from '~/issuable_show/components/issuable_header.vue'; -import IssuableShowRoot from '~/issuable_show/components/issuable_show_root.vue'; +import IssuableBody from '~/vue_shared/issuable/show/components/issuable_body.vue'; +import IssuableHeader from '~/vue_shared/issuable/show/components/issuable_header.vue'; +import IssuableShowRoot from '~/vue_shared/issuable/show/components/issuable_show_root.vue'; import IssuableSidebar from '~/vue_shared/issuable/sidebar/components/issuable_sidebar_root.vue'; diff --git a/spec/frontend/issuable_show/components/issuable_title_spec.js b/spec/frontend/vue_shared/issuable/show/components/issuable_title_spec.js index df6fbdea76b..1fcf37a0477 100644 --- a/spec/frontend/issuable_show/components/issuable_title_spec.js +++ b/spec/frontend/vue_shared/issuable/show/components/issuable_title_spec.js @@ -2,7 +2,7 @@ import { GlIcon, GlButton, GlIntersectionObserver } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; -import IssuableTitle from '~/issuable_show/components/issuable_title.vue'; +import IssuableTitle from '~/vue_shared/issuable/show/components/issuable_title.vue'; import { mockIssuableShowProps, mockIssuable } from '../mock_data'; diff --git a/spec/frontend/issuable_show/mock_data.js b/spec/frontend/vue_shared/issuable/show/mock_data.js index f5f3ed58655..f5f3ed58655 100644 --- a/spec/frontend/issuable_show/mock_data.js +++ b/spec/frontend/vue_shared/issuable/show/mock_data.js |