Commit 6c0a9685 authored by Miguel Rincon's avatar Miguel Rincon

Merge branch 'child-pipeline-fix' into 'master'

Prevents child pipelines from rendering incorrectly on hover

See merge request gitlab-org/gitlab!70526
parents a509a66b 929824d3
...@@ -52,7 +52,7 @@ export default { ...@@ -52,7 +52,7 @@ export default {
required: true, required: true,
}, },
cssClassJobName: { cssClassJobName: {
type: [String, Array], type: [String, Array, Object],
required: false, required: false,
default: '', default: '',
}, },
...@@ -167,9 +167,13 @@ export default { ...@@ -167,9 +167,13 @@ export default {
return this.job.name === this.pipelineExpanded.jobName && this.pipelineExpanded.expanded; return this.job.name === this.pipelineExpanded.jobName && this.pipelineExpanded.expanded;
}, },
jobClasses() { jobClasses() {
return this.relatedDownstreamHovered || this.relatedDownstreamExpanded return [
? `${this.$options.hoverClass} ${this.cssClassJobName}` {
: this.cssClassJobName; [this.$options.hoverClass]:
this.relatedDownstreamHovered || this.relatedDownstreamExpanded,
},
this.cssClassJobName,
];
}, },
}, },
errorCaptured(err, _vm, info) { errorCaptured(err, _vm, info) {
......
...@@ -205,4 +205,64 @@ describe('pipeline graph job item', () => { ...@@ -205,4 +205,64 @@ describe('pipeline graph job item', () => {
}, },
); );
}); });
describe('job classes', () => {
it('job class is shown', () => {
createWrapper({
job: mockJob,
cssClassJobName: 'my-class',
});
expect(wrapper.find('a').classes()).toContain('my-class');
expect(wrapper.find('a').classes()).not.toContain(triggerActiveClass);
});
it('job class is shown, along with hover', () => {
createWrapper({
job: mockJob,
cssClassJobName: 'my-class',
sourceJobHovered: mockJob.name,
});
expect(wrapper.find('a').classes()).toContain('my-class');
expect(wrapper.find('a').classes()).toContain(triggerActiveClass);
});
it('multiple job classes are shown', () => {
createWrapper({
job: mockJob,
cssClassJobName: ['my-class-1', 'my-class-2'],
});
expect(wrapper.find('a').classes()).toContain('my-class-1');
expect(wrapper.find('a').classes()).toContain('my-class-2');
expect(wrapper.find('a').classes()).not.toContain(triggerActiveClass);
});
it('multiple job classes are shown conditionally', () => {
createWrapper({
job: mockJob,
cssClassJobName: { 'my-class-1': true, 'my-class-2': true },
});
expect(wrapper.find('a').classes()).toContain('my-class-1');
expect(wrapper.find('a').classes()).toContain('my-class-2');
expect(wrapper.find('a').classes()).not.toContain(triggerActiveClass);
});
it('multiple job classes are shown, along with a hover', () => {
createWrapper({
job: mockJob,
cssClassJobName: ['my-class-1', 'my-class-2'],
sourceJobHovered: mockJob.name,
});
expect(wrapper.find('a').classes()).toContain('my-class-1');
expect(wrapper.find('a').classes()).toContain('my-class-2');
expect(wrapper.find('a').classes()).toContain(triggerActiveClass);
});
});
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment