Commit 5013d50c authored by pburdette's avatar pburdette Committed by Payton Burdette

Only show tooltip on truncate

For the commit only show the tooltip
if the text is truncated.

Changelog: changed
parent 3abaf468
...@@ -136,6 +136,9 @@ export default { ...@@ -136,6 +136,9 @@ export default {
refUrl() { refUrl() {
return this.commitRef.ref_url || this.commitRef.path; return this.commitRef.ref_url || this.commitRef.path;
}, },
tooltipTitle() {
return this.mergeRequestRef ? this.mergeRequestRef.title : this.commitRef.name;
},
}, },
}; };
</script> </script>
...@@ -148,23 +151,14 @@ export default { ...@@ -148,23 +151,14 @@ export default {
<gl-icon v-else name="branch" /> <gl-icon v-else name="branch" />
</div> </div>
<gl-link <tooltip-on-truncate :title="tooltipTitle" truncate-target="child" placement="top">
v-if="mergeRequestRef" <gl-link v-if="mergeRequestRef" :href="mergeRequestRef.path" class="ref-name">
v-gl-tooltip {{ mergeRequestRef.iid }}
:href="mergeRequestRef.path" </gl-link>
:title="mergeRequestRef.title" <gl-link v-else :href="refUrl" class="ref-name" data-testid="ref-name">
class="ref-name" {{ commitRef.name }}
>{{ mergeRequestRef.iid }}</gl-link </gl-link>
> </tooltip-on-truncate>
<gl-link
v-else
v-gl-tooltip
:href="refUrl"
:title="commitRef.name"
class="ref-name"
data-testid="ref-name"
>{{ commitRef.name }}</gl-link
>
</template> </template>
<gl-icon name="commit" class="commit-icon js-commit-icon" /> <gl-icon name="commit" class="commit-icon js-commit-icon" />
......
...@@ -162,8 +162,6 @@ describe('Commit component', () => { ...@@ -162,8 +162,6 @@ describe('Commit component', () => {
expect(refEl.attributes('href')).toBe(props.commitRef.ref_url); expect(refEl.attributes('href')).toBe(props.commitRef.ref_url);
expect(refEl.attributes('title')).toBe(props.commitRef.name);
expect(findIcon('branch').exists()).toBe(true); expect(findIcon('branch').exists()).toBe(true);
}); });
}); });
...@@ -195,8 +193,6 @@ describe('Commit component', () => { ...@@ -195,8 +193,6 @@ describe('Commit component', () => {
expect(refEl.attributes('href')).toBe(props.mergeRequestRef.path); expect(refEl.attributes('href')).toBe(props.mergeRequestRef.path);
expect(refEl.attributes('title')).toBe(props.mergeRequestRef.title);
expect(findIcon('git-merge').exists()).toBe(true); expect(findIcon('git-merge').exists()).toBe(true);
}); });
}); });
......
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