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_comment_locked_spec.js')
-rw-r--r--spec/frontend/work_items/components/work_item_comment_locked_spec.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/frontend/work_items/components/work_item_comment_locked_spec.js b/spec/frontend/work_items/components/work_item_comment_locked_spec.js
new file mode 100644
index 00000000000..58491c4b09c
--- /dev/null
+++ b/spec/frontend/work_items/components/work_item_comment_locked_spec.js
@@ -0,0 +1,41 @@
+import { GlLink, GlIcon } from '@gitlab/ui';
+import { shallowMount } from '@vue/test-utils';
+import WorkItemCommentLocked from '~/work_items/components/work_item_comment_locked.vue';
+
+const createComponent = ({ workItemType = 'Task', isProjectArchived = false } = {}) =>
+ shallowMount(WorkItemCommentLocked, {
+ propsData: {
+ workItemType,
+ isProjectArchived,
+ },
+ });
+
+describe('WorkItemCommentLocked', () => {
+ let wrapper;
+ const findLockedIcon = () => wrapper.findComponent(GlIcon);
+ const findLearnMoreLink = () => wrapper.findComponent(GlLink);
+
+ it('renders the locked icon', () => {
+ wrapper = createComponent();
+ expect(findLockedIcon().props('name')).toBe('lock');
+ });
+
+ it('has the learn more link', () => {
+ wrapper = createComponent();
+ expect(findLearnMoreLink().attributes('href')).toBe(
+ WorkItemCommentLocked.constantOptions.lockedIssueDocsPath,
+ );
+ });
+
+ describe('when the project is archived', () => {
+ beforeEach(() => {
+ wrapper = createComponent({ isProjectArchived: true });
+ });
+
+ it('learn more link is directed to archived project docs path', () => {
+ expect(findLearnMoreLink().attributes('href')).toBe(
+ WorkItemCommentLocked.constantOptions.archivedProjectDocsPath,
+ );
+ });
+ });
+});