Commit a2ede820 authored by pburdette's avatar pburdette Committed by Kamil Trzciński

Add jobClasses to both jobs

Add jobClasses to job without
link or with a link so the UX
stays the same. Also update specs
to cover both cases.
parent 3161047b
...@@ -143,7 +143,7 @@ export default { ...@@ -143,7 +143,7 @@ export default {
v-else v-else
v-gl-tooltip="{ boundary, placement: 'bottom' }" v-gl-tooltip="{ boundary, placement: 'bottom' }"
:title="tooltipText" :title="tooltipText"
:class="cssClassJobName" :class="jobClasses"
class="js-job-component-tooltip non-details-job-component" class="js-job-component-tooltip non-details-job-component"
data-testid="job-without-link" data-testid="job-without-link"
> >
......
...@@ -37,7 +37,7 @@ describe('pipeline graph job item', () => { ...@@ -37,7 +37,7 @@ describe('pipeline graph job item', () => {
}; };
const mockJobWithoutDetails = { const mockJobWithoutDetails = {
id: 4257, id: 4257,
name: 'test', name: 'job_without_details',
status: { status: {
icon: 'status_success', icon: 'status_success',
text: 'passed', text: 'passed',
...@@ -85,7 +85,7 @@ describe('pipeline graph job item', () => { ...@@ -85,7 +85,7 @@ describe('pipeline graph job item', () => {
expect(wrapper.find('.ci-status-icon-success').exists()).toBe(true); expect(wrapper.find('.ci-status-icon-success').exists()).toBe(true);
expect(wrapper.find('a').exists()).toBe(false); expect(wrapper.find('a').exists()).toBe(false);
expect(trimText(wrapper.find('.ci-status-text').text())).toEqual(mockJob.name); expect(trimText(wrapper.find('.ci-status-text').text())).toEqual(mockJobWithoutDetails.name);
}); });
it('should apply hover class and provided class name', () => { it('should apply hover class and provided class name', () => {
...@@ -158,22 +158,32 @@ describe('pipeline graph job item', () => { ...@@ -158,22 +158,32 @@ describe('pipeline graph job item', () => {
}); });
describe('trigger job highlighting', () => { describe('trigger job highlighting', () => {
it('trigger job should stay highlighted when downstream is expanded', () => { it.each`
createWrapper({ job | jobName | expanded | link
job: mockJob, ${mockJob} | ${mockJob.name} | ${true} | ${true}
pipelineExpanded: { jobName: mockJob.name, expanded: true }, ${mockJobWithoutDetails} | ${mockJobWithoutDetails.name} | ${true} | ${false}
}); `(
`trigger job should stay highlighted when downstream is expanded`,
expect(findJobWithLink().classes()).toContain(triggerActiveClass); ({ job, jobName, expanded, link }) => {
}); createWrapper({ job, pipelineExpanded: { jobName, expanded } });
const findJobEl = link ? findJobWithLink : findJobWithoutLink;
it('trigger job should not be highlighted when downstream is closed', () => {
createWrapper({ expect(findJobEl().classes()).toContain(triggerActiveClass);
job: mockJob, },
pipelineExpanded: { jobName: mockJob.name, expanded: false }, );
});
it.each`
expect(findJobWithLink().classes()).not.toContain(triggerActiveClass); job | jobName | expanded | link
}); ${mockJob} | ${mockJob.name} | ${false} | ${true}
${mockJobWithoutDetails} | ${mockJobWithoutDetails.name} | ${false} | ${false}
`(
`trigger job should stay highlighted when downstream is expanded`,
({ job, jobName, expanded, link }) => {
createWrapper({ job, pipelineExpanded: { jobName, expanded } });
const findJobEl = link ? findJobWithLink : findJobWithoutLink;
expect(findJobEl().classes()).not.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