summaryrefslogtreecommitdiff
path: root/spec/frontend/commit
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-03 00:05:59 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-03 00:05:59 +0000
commit427b23c12718bea233931431e7d9307881a960c0 (patch)
tree5e15672783c950a5e68dd89517d7888e652e01a7 /spec/frontend/commit
parent6d60f910762c1a92a07a4afaf1b26962f75ee4b6 (diff)
downloadgitlab-ce-427b23c12718bea233931431e7d9307881a960c0.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/commit')
-rw-r--r--spec/frontend/commit/__snapshots__/commit_pipeline_status_component_spec.js.snap39
-rw-r--r--spec/frontend/commit/commit_pipeline_status_component_spec.js39
2 files changed, 33 insertions, 45 deletions
diff --git a/spec/frontend/commit/__snapshots__/commit_pipeline_status_component_spec.js.snap b/spec/frontend/commit/__snapshots__/commit_pipeline_status_component_spec.js.snap
deleted file mode 100644
index 9199db69fed..00000000000
--- a/spec/frontend/commit/__snapshots__/commit_pipeline_status_component_spec.js.snap
+++ /dev/null
@@ -1,39 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Commit pipeline status component when polling is not successful renders not found CI icon without loader 1`] = `
-<div
- class="ci-status-link"
->
- <a>
- <ciicon-stub
- aria-label="Pipeline: not found"
- cssclasses=""
- data-container="body"
- data-original-title="Pipeline: not found"
- size="24"
- status="[object Object]"
- title=""
- />
- </a>
-</div>
-`;
-
-exports[`Commit pipeline status component when polling is successful renders CI icon without loader 1`] = `
-<div
- class="ci-status-link"
->
- <a
- href="/frontend-fixtures/pipelines-project/pipelines/47"
- >
- <ciicon-stub
- aria-label="Pipeline: pending"
- cssclasses=""
- data-container="body"
- data-original-title="Pipeline: pending"
- size="24"
- status="[object Object]"
- title=""
- />
- </a>
-</div>
-`;
diff --git a/spec/frontend/commit/commit_pipeline_status_component_spec.js b/spec/frontend/commit/commit_pipeline_status_component_spec.js
index 1768fd745c9..1736d1d0df8 100644
--- a/spec/frontend/commit/commit_pipeline_status_component_spec.js
+++ b/spec/frontend/commit/commit_pipeline_status_component_spec.js
@@ -2,6 +2,7 @@ import Visibility from 'visibilityjs';
import { GlLoadingIcon } from '@gitlab/ui';
import Poll from '~/lib/utils/poll';
import flash from '~/flash';
+import CiIcon from '~/vue_shared/components/ci_icon.vue';
import CommitPipelineStatus from '~/projects/tree/components/commit_pipeline_status_component.vue';
import { shallowMount } from '@vue/test-utils';
import { getJSONFixture } from '../helpers/fixtures';
@@ -36,6 +37,10 @@ describe('Commit pipeline status component', () => {
});
};
+ const findLoader = () => wrapper.find(GlLoadingIcon);
+ const findLink = () => wrapper.find('a');
+ const findCiIcon = () => findLink().find(CiIcon);
+
afterEach(() => {
wrapper.destroy();
wrapper = null;
@@ -111,14 +116,14 @@ describe('Commit pipeline status component', () => {
it('shows the loading icon at start', () => {
createComponent();
- expect(wrapper.find(GlLoadingIcon).exists()).toBe(true);
+ expect(findLoader().exists()).toBe(true);
pollConfig.successCallback({
data: { pipelines: [] },
});
return wrapper.vm.$nextTick().then(() => {
- expect(wrapper.find(GlLoadingIcon).exists()).toBe(false);
+ expect(findLoader().exists()).toBe(false);
});
});
@@ -130,8 +135,17 @@ describe('Commit pipeline status component', () => {
return wrapper.vm.$nextTick();
});
- it('renders CI icon without loader', () => {
- expect(wrapper.element).toMatchSnapshot();
+ it('does not render loader', () => {
+ expect(findLoader().exists()).toBe(false);
+ });
+
+ it('renders link with href', () => {
+ expect(findLink().attributes('href')).toEqual(mockCiStatus.details_path);
+ });
+
+ it('renders CI icon', () => {
+ expect(findCiIcon().attributes('data-original-title')).toEqual('Pipeline: pending');
+ expect(findCiIcon().props('status')).toEqual(mockCiStatus);
});
});
@@ -140,8 +154,21 @@ describe('Commit pipeline status component', () => {
pollConfig.errorCallback();
});
- it('renders not found CI icon without loader', () => {
- expect(wrapper.element).toMatchSnapshot();
+ it('does not render loader', () => {
+ expect(findLoader().exists()).toBe(false);
+ });
+
+ it('renders link with href', () => {
+ expect(findLink().attributes('href')).toBeUndefined();
+ });
+
+ it('renders not found CI icon', () => {
+ expect(findCiIcon().attributes('data-original-title')).toEqual('Pipeline: not found');
+ expect(findCiIcon().props('status')).toEqual({
+ text: 'not found',
+ icon: 'status_notfound',
+ group: 'notfound',
+ });
});
it('displays flash error message', () => {