diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-16 12:09:38 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-16 12:09:38 +0300 |
commit | bc9b43904d491c7b864c8fb6ba06ae0f6625db0d (patch) | |
tree | ca0a5ae3bbbf98530707b96a7db08d1bd773b429 /spec/frontend/work_items/components/work_item_links/work_item_link_child_spec.js | |
parent | 10476ea7d8253d8462e092ed95aedc01204238bc (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/work_items/components/work_item_links/work_item_link_child_spec.js')
-rw-r--r-- | spec/frontend/work_items/components/work_item_links/work_item_link_child_spec.js | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/spec/frontend/work_items/components/work_item_links/work_item_link_child_spec.js b/spec/frontend/work_items/components/work_item_links/work_item_link_child_spec.js index 3a8e785bc80..73d498ad055 100644 --- a/spec/frontend/work_items/components/work_item_links/work_item_link_child_spec.js +++ b/spec/frontend/work_items/components/work_item_links/work_item_link_child_spec.js @@ -1,4 +1,4 @@ -import { GlButton, GlIcon } from '@gitlab/ui'; +import { GlIcon } from '@gitlab/ui'; import Vue from 'vue'; import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; @@ -9,6 +9,7 @@ import { createAlert } from '~/flash'; import RichTimestampTooltip from '~/vue_shared/components/rich_timestamp_tooltip.vue'; import getWorkItemTreeQuery from '~/work_items/graphql/work_item_tree.query.graphql'; +import WorkItemLinkChildMetadata from '~/work_items/components/work_item_links/work_item_link_child_metadata.vue'; import WorkItemLinkChild from '~/work_items/components/work_item_links/work_item_link_child.vue'; import WorkItemLinksMenu from '~/work_items/components/work_item_links/work_item_links_menu.vue'; import WorkItemTreeChildren from '~/work_items/components/work_item_links/work_item_tree_children.vue'; @@ -21,8 +22,12 @@ import { import { workItemTask, workItemObjectiveWithChild, + workItemObjectiveNoMetadata, confidentialWorkItemTask, closedWorkItemTask, + mockMilestone, + mockAssignees, + mockLabels, workItemHierarchyTreeResponse, workItemHierarchyTreeFailureResponse, } from '../../mock_data'; @@ -101,7 +106,7 @@ describe('WorkItemLinkChild', () => { beforeEach(() => { createComponent(); - titleEl = wrapper.findComponent(GlButton); + titleEl = wrapper.findByTestId('item-title'); }); it('renders item title', () => { @@ -129,6 +134,37 @@ describe('WorkItemLinkChild', () => { }); }); + describe('item metadata', () => { + const findMetadataComponent = () => wrapper.findComponent(WorkItemLinkChildMetadata); + + beforeEach(() => { + createComponent({ + childItem: workItemObjectiveWithChild, + workItemType: WORK_ITEM_TYPE_VALUE_OBJECTIVE, + }); + }); + + it('renders item metadata component when item has metadata present', () => { + const metadataEl = findMetadataComponent(); + expect(metadataEl.exists()).toBe(true); + expect(metadataEl.props()).toMatchObject({ + allowsScopedLabels: true, + milestone: mockMilestone, + assignees: mockAssignees, + labels: mockLabels, + }); + }); + + it('does not render item metadata component when item has no metadata present', () => { + createComponent({ + childItem: workItemObjectiveNoMetadata, + workItemType: WORK_ITEM_TYPE_VALUE_OBJECTIVE, + }); + + expect(findMetadataComponent().exists()).toBe(false); + }); + }); + describe('item menu', () => { let itemMenuEl; |