Commit fd315c20 authored by Eric Eastwood's avatar Eric Eastwood

Remove href link from pending references with a empty path

parent 0269d05c
...@@ -50,6 +50,12 @@ export default { ...@@ -50,6 +50,12 @@ export default {
hasTitle() { hasTitle() {
return this.title.length > 0; return this.title.length > 0;
}, },
computedLinkElementType() {
return this.path.length > 0 ? 'a' : 'span';
},
computedPath() {
return this.path.length ? this.path : null;
},
}, },
methods: { methods: {
...@@ -79,10 +85,11 @@ export default { ...@@ -79,10 +85,11 @@ export default {
<template> <template>
<div class="issue-token"> <div class="issue-token">
<a <component
:is="this.computedLinkElementType"
ref="link" ref="link"
class="issue-token-link" class="issue-token-link"
:href="path" :href="computedPath"
:title="title" :title="title"
data-toggle="tooltip" data-toggle="tooltip"
data-placement="top"> data-placement="top">
...@@ -110,7 +117,7 @@ export default { ...@@ -110,7 +117,7 @@ export default {
{{ title }} {{ title }}
</span> </span>
</span> </span>
</a> </component>
<button <button
ref="removeButton" ref="removeButton"
v-if="canRemove" v-if="canRemove"
......
...@@ -292,6 +292,12 @@ ul.related-merge-requests > li { ...@@ -292,6 +292,12 @@ ul.related-merge-requests > li {
display: inline-flex; display: inline-flex;
min-width: 0; min-width: 0;
color: $gl-text-color-secondary;
&[href] {
color: $gl-link-color;
}
&:hover, &:hover,
&:focus { &:focus {
outline: none; outline: none;
......
...@@ -3,7 +3,7 @@ import eventHub from '~/issuable/related_issues/event_hub'; ...@@ -3,7 +3,7 @@ import eventHub from '~/issuable/related_issues/event_hub';
import issueToken from '~/issuable/related_issues/components/issue_token.vue'; import issueToken from '~/issuable/related_issues/components/issue_token.vue';
describe('IssueToken', () => { describe('IssueToken', () => {
const idKey = '200'; const idKey = 200;
const displayReference = 'foo/bar#123'; const displayReference = 'foo/bar#123';
const title = 'some title'; const title = 'some title';
let IssueToken; let IssueToken;
...@@ -32,6 +32,11 @@ describe('IssueToken', () => { ...@@ -32,6 +32,11 @@ describe('IssueToken', () => {
it('shows reference', () => { it('shows reference', () => {
expect(vm.$el.textContent.trim()).toEqual(displayReference); expect(vm.$el.textContent.trim()).toEqual(displayReference);
}); });
it('does not link without path specified', () => {
expect(vm.$refs.link.tagName.toLowerCase()).toEqual('span');
expect(vm.$refs.link.getAttribute('href')).toBeNull();
});
}); });
describe('with reference and title supplied', () => { describe('with reference and title supplied', () => {
......
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