Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-18 21:07:53 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-18 21:07:53 +0300
commite69b62ceed2f15335d9526923f8f72f5ca5ea6aa (patch)
treee36510511cb555865375117fd1c2208e09eea970 /spec/frontend/work_items
parent493e288e6de17f2d85fe981f8bb0b9dfabdf9c6d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/work_items')
-rw-r--r--spec/frontend/work_items/components/work_item_detail_modal_spec.js11
-rw-r--r--spec/frontend/work_items/components/work_item_detail_spec.js10
-rw-r--r--spec/frontend/work_items/components/work_item_links/work_item_children_wrapper_spec.js1
-rw-r--r--spec/frontend/work_items/components/work_item_links/work_item_links_spec.js26
-rw-r--r--spec/frontend/work_items/mock_data.js188
-rw-r--r--spec/frontend/work_items/pages/work_item_root_spec.js3
6 files changed, 117 insertions, 122 deletions
diff --git a/spec/frontend/work_items/components/work_item_detail_modal_spec.js b/spec/frontend/work_items/components/work_item_detail_modal_spec.js
index e305cc310bd..d8e38af9f75 100644
--- a/spec/frontend/work_items/components/work_item_detail_modal_spec.js
+++ b/spec/frontend/work_items/components/work_item_detail_modal_spec.js
@@ -68,7 +68,6 @@ describe('WorkItemDetailModal component', () => {
expect(findWorkItemDetail().props()).toEqual({
isModal: true,
- workItemId,
workItemIid: '1',
workItemParentId: null,
});
@@ -113,14 +112,10 @@ describe('WorkItemDetailModal component', () => {
it('updates the work item when WorkItemDetail emits `update-modal` event', async () => {
createComponent();
- findWorkItemDetail().vm.$emit('update-modal', undefined, {
- id: 'updatedId',
- iid: 'updatedIid',
- });
- await waitForPromises();
+ findWorkItemDetail().vm.$emit('update-modal', undefined, { iid: 'updatedIid' });
+ await nextTick();
- expect(findWorkItemDetail().props().workItemId).toEqual('updatedId');
- expect(findWorkItemDetail().props().workItemIid).toEqual('updatedIid');
+ expect(findWorkItemDetail().props('workItemIid')).toBe('updatedIid');
});
describe('delete work item', () => {
diff --git a/spec/frontend/work_items/components/work_item_detail_spec.js b/spec/frontend/work_items/components/work_item_detail_spec.js
index 1b6ea8186bd..d8ba8ea74f2 100644
--- a/spec/frontend/work_items/components/work_item_detail_spec.js
+++ b/spec/frontend/work_items/components/work_item_detail_spec.js
@@ -100,7 +100,6 @@ describe('WorkItemDetail component', () => {
const createComponent = ({
isModal = false,
updateInProgress = false,
- workItemId = id,
workItemIid = '1',
handler = successHandler,
subscriptionHandler = titleSubscriptionHandler,
@@ -120,7 +119,10 @@ describe('WorkItemDetail component', () => {
wrapper = shallowMount(WorkItemDetail, {
apolloProvider: createMockApollo(handlers),
isLoggedIn: isLoggedIn(),
- propsData: { isModal, workItemId, workItemIid },
+ propsData: {
+ isModal,
+ workItemIid,
+ },
data() {
return {
updateInProgress,
@@ -160,9 +162,9 @@ describe('WorkItemDetail component', () => {
setWindowLocation('');
});
- describe('when there is no `workItemId` and no `workItemIid` prop', () => {
+ describe('when there is no `workItemIid` prop', () => {
beforeEach(() => {
- createComponent({ workItemId: null, workItemIid: null });
+ createComponent({ workItemIid: null });
});
it('skips the work item query', () => {
diff --git a/spec/frontend/work_items/components/work_item_links/work_item_children_wrapper_spec.js b/spec/frontend/work_items/components/work_item_links/work_item_children_wrapper_spec.js
index b06be6c8083..805f243cc00 100644
--- a/spec/frontend/work_items/components/work_item_links/work_item_children_wrapper_spec.js
+++ b/spec/frontend/work_items/components/work_item_links/work_item_children_wrapper_spec.js
@@ -36,7 +36,6 @@ describe('WorkItemChildrenWrapper', () => {
workItemId: 'gid://gitlab/WorkItem/515',
confidential,
children,
- fetchByIid: true,
},
});
};
diff --git a/spec/frontend/work_items/components/work_item_links/work_item_links_spec.js b/spec/frontend/work_items/components/work_item_links/work_item_links_spec.js
index 786f8604039..a33177d75a2 100644
--- a/spec/frontend/work_items/components/work_item_links/work_item_links_spec.js
+++ b/spec/frontend/work_items/components/work_item_links/work_item_links_spec.js
@@ -14,7 +14,6 @@ import WorkItemDetailModal from '~/work_items/components/work_item_detail_modal.
import AbuseCategorySelector from '~/abuse_reports/components/abuse_category_selector.vue';
import { FORM_TYPES } from '~/work_items/constants';
import changeWorkItemParentMutation from '~/work_items/graphql/update_work_item.mutation.graphql';
-import workItemQuery from '~/work_items/graphql/work_item.query.graphql';
import workItemByIidQuery from '~/work_items/graphql/work_item_by_iid.query.graphql';
import {
getIssueDetailsResponse,
@@ -45,14 +44,12 @@ describe('WorkItemLinks', () => {
const mutationChangeParentHandler = jest
.fn()
.mockResolvedValue(changeWorkItemParentMutationResponse);
- const childWorkItemByIidHandler = jest.fn().mockResolvedValue(workItemByIidResponseFactory());
const responseWithAddChildPermission = jest.fn().mockResolvedValue(workItemHierarchyResponse);
const responseWithoutAddChildPermission = jest
.fn()
.mockResolvedValue(workItemByIidResponseFactory({ adminParentLink: false }));
const createComponent = async ({
- data = {},
fetchHandler = responseWithAddChildPermission,
mutationHandler = mutationChangeParentHandler,
issueDetailsQueryHandler = jest.fn().mockResolvedValue(getIssueDetailsResponse()),
@@ -60,27 +57,24 @@ describe('WorkItemLinks', () => {
} = {}) => {
mockApollo = createMockApollo(
[
- [workItemQuery, fetchHandler],
+ [workItemByIidQuery, fetchHandler],
[changeWorkItemParentMutation, mutationHandler],
[issueDetailsQuery, issueDetailsQueryHandler],
- [workItemByIidQuery, childWorkItemByIidHandler],
],
resolvers,
{ addTypename: true },
);
wrapper = shallowMountExtended(WorkItemLinks, {
- data() {
- return {
- ...data,
- };
- },
provide: {
fullPath: 'project/path',
hasIterationsFeature,
reportAbusePath: '/report/abuse/path',
},
- propsData: { issuableId: 1 },
+ propsData: {
+ issuableId: 1,
+ issuableIid: 1,
+ },
apolloProvider: mockApollo,
mocks: {
$toast,
@@ -289,16 +283,6 @@ describe('WorkItemLinks', () => {
});
});
- it('starts prefetching work item by iid if URL contains work_item_iid query parameter', async () => {
- setWindowLocation('?work_item_iid=5');
- await createComponent();
-
- expect(childWorkItemByIidHandler).toHaveBeenCalledWith({
- iid: '5',
- fullPath: 'project/path',
- });
- });
-
it('does not open the modal if work item iid URL parameter is not found in child items', async () => {
setWindowLocation('?work_item_iid=555');
await createComponent();
diff --git a/spec/frontend/work_items/mock_data.js b/spec/frontend/work_items/mock_data.js
index 93f24cf2337..fd31074378b 100644
--- a/spec/frontend/work_items/mock_data.js
+++ b/spec/frontend/work_items/mock_data.js
@@ -928,49 +928,57 @@ export const workItemMilestoneSubscriptionResponse = {
export const workItemHierarchyEmptyResponse = {
data: {
- workItem: {
- id: 'gid://gitlab/WorkItem/1',
- iid: '1',
- state: 'OPEN',
- workItemType: {
- id: 'gid://gitlab/WorkItems::Type/1',
- name: 'Issue',
- iconName: 'issue-type-issue',
- __typename: 'WorkItemType',
- },
- title: 'New title',
- description: '',
- createdAt: '2022-08-03T12:41:54Z',
- updatedAt: null,
- closedAt: null,
- author: mockAssignees[0],
- project: {
- __typename: 'Project',
- id: '1',
- fullPath: 'test-project-path',
- archived: false,
- },
- userPermissions: {
- deleteWorkItem: false,
- updateWorkItem: false,
- setWorkItemMetadata: false,
- adminParentLink: false,
- __typename: 'WorkItemPermissions',
- },
- confidential: false,
- widgets: [
- {
- type: 'HIERARCHY',
- parent: null,
- hasChildren: false,
- children: {
- nodes: [],
- __typename: 'WorkItemConnection',
+ workspace: {
+ __typename: 'Project',
+ id: 'gid://gitlab/Project/2',
+ workItems: {
+ nodes: [
+ {
+ id: 'gid://gitlab/WorkItem/1',
+ iid: '1',
+ state: 'OPEN',
+ workItemType: {
+ id: 'gid://gitlab/WorkItems::Type/1',
+ name: 'Issue',
+ iconName: 'issue-type-issue',
+ __typename: 'WorkItemType',
+ },
+ title: 'New title',
+ description: '',
+ createdAt: '2022-08-03T12:41:54Z',
+ updatedAt: null,
+ closedAt: null,
+ author: mockAssignees[0],
+ project: {
+ __typename: 'Project',
+ id: '1',
+ fullPath: 'test-project-path',
+ archived: false,
+ },
+ userPermissions: {
+ deleteWorkItem: false,
+ updateWorkItem: false,
+ setWorkItemMetadata: false,
+ adminParentLink: false,
+ __typename: 'WorkItemPermissions',
+ },
+ confidential: false,
+ widgets: [
+ {
+ type: 'HIERARCHY',
+ parent: null,
+ hasChildren: false,
+ children: {
+ nodes: [],
+ __typename: 'WorkItemConnection',
+ },
+ __typename: 'WorkItemWidgetHierarchy',
+ },
+ ],
+ __typename: 'WorkItem',
},
- __typename: 'WorkItemWidgetHierarchy',
- },
- ],
- __typename: 'WorkItem',
+ ],
+ },
},
},
};
@@ -1126,51 +1134,59 @@ export const childrenWorkItems = [
export const workItemHierarchyResponse = {
data: {
- workItem: {
- id: 'gid://gitlab/WorkItem/1',
- iid: '1',
- workItemType: {
- id: 'gid://gitlab/WorkItems::Type/1',
- name: 'Issue',
- iconName: 'issue-type-issue',
- __typename: 'WorkItemType',
- },
- title: 'New title',
- userPermissions: {
- deleteWorkItem: true,
- updateWorkItem: true,
- setWorkItemMetadata: true,
- adminParentLink: true,
- __typename: 'WorkItemPermissions',
- },
- author: {
- ...mockAssignees[0],
- },
- confidential: false,
- project: {
- __typename: 'Project',
- id: '1',
- fullPath: 'test-project-path',
- archived: false,
- },
- description: 'Issue description',
- state: 'OPEN',
- createdAt: '2022-08-03T12:41:54Z',
- updatedAt: null,
- closedAt: null,
- widgets: [
- {
- type: 'HIERARCHY',
- parent: null,
- hasChildren: true,
- children: {
- nodes: childrenWorkItems,
- __typename: 'WorkItemConnection',
+ workspace: {
+ __typename: 'Project',
+ id: 'gid://gitlab/Project/2',
+ workItems: {
+ nodes: [
+ {
+ id: 'gid://gitlab/WorkItem/1',
+ iid: '1',
+ workItemType: {
+ id: 'gid://gitlab/WorkItems::Type/1',
+ name: 'Issue',
+ iconName: 'issue-type-issue',
+ __typename: 'WorkItemType',
+ },
+ title: 'New title',
+ userPermissions: {
+ deleteWorkItem: true,
+ updateWorkItem: true,
+ setWorkItemMetadata: true,
+ adminParentLink: true,
+ __typename: 'WorkItemPermissions',
+ },
+ author: {
+ ...mockAssignees[0],
+ },
+ confidential: false,
+ project: {
+ __typename: 'Project',
+ id: '1',
+ fullPath: 'test-project-path',
+ archived: false,
+ },
+ description: 'Issue description',
+ state: 'OPEN',
+ createdAt: '2022-08-03T12:41:54Z',
+ updatedAt: null,
+ closedAt: null,
+ widgets: [
+ {
+ type: 'HIERARCHY',
+ parent: null,
+ hasChildren: true,
+ children: {
+ nodes: childrenWorkItems,
+ __typename: 'WorkItemConnection',
+ },
+ __typename: 'WorkItemWidgetHierarchy',
+ },
+ ],
+ __typename: 'WorkItem',
},
- __typename: 'WorkItemWidgetHierarchy',
- },
- ],
- __typename: 'WorkItem',
+ ],
+ },
},
},
};
diff --git a/spec/frontend/work_items/pages/work_item_root_spec.js b/spec/frontend/work_items/pages/work_item_root_spec.js
index c480affe484..84b10f30418 100644
--- a/spec/frontend/work_items/pages/work_item_root_spec.js
+++ b/spec/frontend/work_items/pages/work_item_root_spec.js
@@ -34,7 +34,7 @@ describe('Work items root component', () => {
issuesListPath,
},
propsData: {
- id: '1',
+ iid: '1',
},
mocks: {
$toast: {
@@ -49,7 +49,6 @@ describe('Work items root component', () => {
expect(findWorkItemDetail().props()).toEqual({
isModal: false,
- workItemId: 'gid://gitlab/WorkItem/1',
workItemParentId: null,
workItemIid: '1',
});