Commit 6922316f authored by Kushal Pandya's avatar Kushal Pandya

Merge branch...

Merge branch '12250-fix-permissions-for-dependency-list-project-hide-link-to-failed-pipeline-if-no-jobpath' into 'master'

Dependency List Job Failed Alert - Hide link to job if payload from API does not include `job_path`

See merge request gitlab-org/gitlab-ee!15068
parents 6ce74eb6 f46abd4c
......@@ -12,7 +12,8 @@ export default {
props: {
jobPath: {
type: String,
required: true,
required: false,
default: '',
},
},
data() {
......@@ -36,7 +37,7 @@ export default {
v-on="$listeners"
>
<p v-html="message"></p>
<gl-button :href="jobPath" class="btn-inverted btn-danger mb-2">
<gl-button v-if="jobPath" :href="jobPath" class="btn-inverted btn-danger mb-2">
{{ __('View job') }}
</gl-button>
</dependency-list-alert>
......
---
title: Dependency List Job Failed Alert - Hide link to job if payload from API does
not include 'job_path'
merge_request: 15068
author:
type: changed
import { createLocalVue, shallowMount } from '@vue/test-utils';
import { GlButton } from '@gitlab/ui';
import DependencyListAlert from 'ee/dependencies/components/dependency_list_alert.vue';
import DependencyListJobFailedAlert from 'ee/dependencies/components/dependency_list_job_failed_alert.vue';
......@@ -24,6 +25,27 @@ describe('DependencyListJobFailedAlert component', () => {
expect(wrapper.element).toMatchSnapshot();
});
it('inludes a button button if "jobPath" is given', () => {
factory({ propsData: { jobPath: '/jobs/foo/3210' } });
expect(wrapper.find(GlButton).exists()).toBe(true);
});
it('does not include a button if "jobPath" is not given', () => {
factory();
expect(wrapper.find(GlButton).exists()).toBe(false);
});
it.each([undefined, null, ''])(
'does not include a button if "jobPath" is given but empty',
jobPath => {
factory({ propsData: { jobPath } });
expect(wrapper.find(GlButton).exists()).toBe(false);
},
);
describe('when the generic alert component emits a close event', () => {
let closeListenerSpy;
......
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