summaryrefslogtreecommitdiff
path: root/spec/frontend/pipelines
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-15 06:08:54 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-15 06:08:54 +0000
commita552864a355f31c496e476ad4e57585aeab95a12 (patch)
tree4f64140ae93033e7b8e7ee683666d506eca41b68 /spec/frontend/pipelines
parent4998f4e2d82409aaebb4a0fb6f85ad130819da57 (diff)
downloadgitlab-ce-a552864a355f31c496e476ad4e57585aeab95a12.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/pipelines')
-rw-r--r--spec/frontend/pipelines/graph/linked_pipeline_spec.js63
-rw-r--r--spec/frontend/pipelines/graph/linked_pipelines_mock_data.js4
2 files changed, 54 insertions, 13 deletions
diff --git a/spec/frontend/pipelines/graph/linked_pipeline_spec.js b/spec/frontend/pipelines/graph/linked_pipeline_spec.js
index 8cd9cb7e95d..de1f9142001 100644
--- a/spec/frontend/pipelines/graph/linked_pipeline_spec.js
+++ b/spec/frontend/pipelines/graph/linked_pipeline_spec.js
@@ -8,6 +8,13 @@ const mockPipeline = mockData.triggered[0];
describe('Linked pipeline', () => {
let wrapper;
+ const createWrapper = propsData => {
+ wrapper = mount(LinkedPipelineComponent, {
+ attachToDocument: true,
+ propsData,
+ });
+ };
+
afterEach(() => {
wrapper.destroy();
});
@@ -15,13 +22,12 @@ describe('Linked pipeline', () => {
describe('rendered output', () => {
const props = {
pipeline: mockPipeline,
+ projectId: 20,
+ columnTitle: 'Downstream',
};
beforeEach(() => {
- wrapper = mount(LinkedPipelineComponent, {
- attachToDocument: true,
- propsData: props,
- });
+ createWrapper(props);
});
it('should render a list item as the containing element', () => {
@@ -73,18 +79,50 @@ describe('Linked pipeline', () => {
it('does not render the loading icon when isLoading is false', () => {
expect(wrapper.find('.js-linked-pipeline-loading').exists()).toBe(false);
});
+
+ it('should not display child label when pipeline project id is not the same as triggered pipeline project id', () => {
+ const labelContainer = wrapper.find('.parent-child-label-container');
+ expect(labelContainer.exists()).toBe(false);
+ });
+ });
+
+ describe('parent/child', () => {
+ const downstreamProps = {
+ pipeline: mockPipeline,
+ projectId: 19,
+ columnTitle: 'Downstream',
+ };
+
+ const upstreamProps = {
+ ...downstreamProps,
+ columnTitle: 'Upstream',
+ };
+
+ it('parent/child label container should exist', () => {
+ createWrapper(downstreamProps);
+ expect(wrapper.find('.parent-child-label-container').exists()).toBe(true);
+ });
+
+ it('should display child label when pipeline project id is the same as triggered pipeline project id', () => {
+ createWrapper(downstreamProps);
+ expect(wrapper.find('.parent-child-label-container').text()).toContain('Child');
+ });
+
+ it('should display parent label when pipeline project id is the same as triggered_by pipeline project id', () => {
+ createWrapper(upstreamProps);
+ expect(wrapper.find('.parent-child-label-container').text()).toContain('Parent');
+ });
});
describe('when isLoading is true', () => {
const props = {
pipeline: { ...mockPipeline, isLoading: true },
+ projectId: 19,
+ columnTitle: 'Downstream',
};
beforeEach(() => {
- wrapper = mount(LinkedPipelineComponent, {
- attachToDocument: true,
- propsData: props,
- });
+ createWrapper(props);
});
it('renders a loading icon', () => {
@@ -95,20 +133,19 @@ describe('Linked pipeline', () => {
describe('on click', () => {
const props = {
pipeline: mockPipeline,
+ projectId: 19,
+ columnTitle: 'Downstream',
};
beforeEach(() => {
- wrapper = mount(LinkedPipelineComponent, {
- attachToDocument: true,
- propsData: props,
- });
+ createWrapper(props);
});
it('emits `pipelineClicked` event', () => {
jest.spyOn(wrapper.vm, '$emit');
wrapper.find('button').trigger('click');
- expect(wrapper.vm.$emit).toHaveBeenCalledWith('pipelineClicked');
+ expect(wrapper.emitted().pipelineClicked).toBeTruthy();
});
it('should emit `bv::hide::tooltip` to close the tooltip', () => {
diff --git a/spec/frontend/pipelines/graph/linked_pipelines_mock_data.js b/spec/frontend/pipelines/graph/linked_pipelines_mock_data.js
index f794b8484a7..c9a94b3101f 100644
--- a/spec/frontend/pipelines/graph/linked_pipelines_mock_data.js
+++ b/spec/frontend/pipelines/graph/linked_pipelines_mock_data.js
@@ -1,4 +1,7 @@
export default {
+ project: {
+ id: 19,
+ },
triggered_by: {
id: 129,
active: true,
@@ -63,6 +66,7 @@ export default {
path: '/gitlab-org/gitlab-foss/pipelines/132',
project: {
name: 'GitLabCE',
+ id: 19,
},
details: {
status: {