summaryrefslogtreecommitdiff
path: root/spec/frontend/commit/commit_pipeline_status_component_spec.js
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/commit_pipeline_status_component_spec.js
parent6d60f910762c1a92a07a4afaf1b26962f75ee4b6 (diff)
downloadgitlab-ce-427b23c12718bea233931431e7d9307881a960c0.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/commit/commit_pipeline_status_component_spec.js')
-rw-r--r--spec/frontend/commit/commit_pipeline_status_component_spec.js39
1 files changed, 33 insertions, 6 deletions
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', () => {