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:
Diffstat (limited to 'spec/frontend/work_items/components/work_item_created_updated_spec.js')
-rw-r--r--spec/frontend/work_items/components/work_item_created_updated_spec.js38
1 files changed, 34 insertions, 4 deletions
diff --git a/spec/frontend/work_items/components/work_item_created_updated_spec.js b/spec/frontend/work_items/components/work_item_created_updated_spec.js
index 428b33aecfa..f77c5481906 100644
--- a/spec/frontend/work_items/components/work_item_created_updated_spec.js
+++ b/spec/frontend/work_items/components/work_item_created_updated_spec.js
@@ -1,10 +1,11 @@
-import { GlAvatarLink, GlSprintf } from '@gitlab/ui';
+import { GlAvatarLink, GlSprintf, GlLoadingIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import createMockApollo from 'helpers/mock_apollo_helper';
import waitForPromises from 'helpers/wait_for_promises';
import WorkItemCreatedUpdated from '~/work_items/components/work_item_created_updated.vue';
+import ConfidentialityBadge from '~/vue_shared/components/confidentiality_badge.vue';
import WorkItemTypeIcon from '~/work_items/components/work_item_type_icon.vue';
import workItemByIidQuery from '~/work_items/graphql/work_item_by_iid.query.graphql';
import { workItemByIidResponseFactory, mockAssignees } from '../mock_data';
@@ -20,11 +21,20 @@ describe('WorkItemCreatedUpdated component', () => {
const findCreatedAtText = () => findCreatedAt().text().replace(/\s+/g, ' ');
const findWorkItemTypeIcon = () => wrapper.findComponent(WorkItemTypeIcon);
-
- const createComponent = async ({ workItemIid = '1', author = null, updatedAt } = {}) => {
+ const findConfidentialityBadge = () => wrapper.findComponent(ConfidentialityBadge);
+ const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon);
+
+ const createComponent = async ({
+ workItemIid = '1',
+ author = null,
+ updatedAt,
+ confidential = false,
+ updateInProgress = false,
+ } = {}) => {
const workItemQueryResponse = workItemByIidResponseFactory({
author,
updatedAt,
+ confidential,
});
successHandler = jest.fn().mockResolvedValue(workItemQueryResponse);
@@ -34,7 +44,7 @@ describe('WorkItemCreatedUpdated component', () => {
provide: {
fullPath: '/some/project',
},
- propsData: { workItemIid },
+ propsData: { workItemIid, updateInProgress },
stubs: {
GlAvatarLink,
GlSprintf,
@@ -88,4 +98,24 @@ describe('WorkItemCreatedUpdated component', () => {
expect(findUpdatedAt().exists()).toBe(false);
});
+
+ describe('confidential badge', () => {
+ it('renders badge when the work item is confidential', async () => {
+ await createComponent({ confidential: true });
+
+ expect(findConfidentialityBadge().exists()).toBe(true);
+ });
+
+ it('does not render badge when the work item is confidential', async () => {
+ await createComponent({ confidential: false });
+
+ expect(findConfidentialityBadge().exists()).toBe(false);
+ });
+
+ it('shows loading icon badge when the work item is confidential', async () => {
+ await createComponent({ updateInProgress: true });
+
+ expect(findLoadingIcon().exists()).toBe(true);
+ });
+ });
});