Commit 632d3a94 authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'ide-header-buttons-tooltip' into 'master'

Added tooltips to tree list header buttons in Web IDE

Closes #50141

See merge request gitlab-org/gitlab-ce!21138
parents 7167e399 dcec0907
<script> <script>
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import tooltip from '~/vue_shared/directives/tooltip';
export default { export default {
directives: {
tooltip,
},
components: { components: {
Icon, Icon,
}, },
...@@ -26,6 +30,11 @@ export default { ...@@ -26,6 +30,11 @@ export default {
default: true, default: true,
}, },
}, },
computed: {
tooltipTitle() {
return this.showLabel ? '' : this.label;
},
},
methods: { methods: {
clicked() { clicked() {
this.$emit('click'); this.$emit('click');
...@@ -36,7 +45,9 @@ export default { ...@@ -36,7 +45,9 @@ export default {
<template> <template>
<button <button
v-tooltip
:aria-label="label" :aria-label="label"
:title="tooltipTitle"
type="button" type="button"
class="btn-blank" class="btn-blank"
@click.stop.prevent="clicked" @click.stop.prevent="clicked"
......
---
title: Added tooltips to tree list header
merge_request: 21138
author:
type: added
...@@ -46,4 +46,20 @@ describe('IDE new entry dropdown button component', () => { ...@@ -46,4 +46,20 @@ describe('IDE new entry dropdown button component', () => {
done(); done();
}); });
}); });
describe('tooltipTitle', () => {
it('returns empty string when showLabel is true', () => {
expect(vm.tooltipTitle).toBe('');
});
it('returns label', done => {
vm.showLabel = false;
vm.$nextTick(() => {
expect(vm.tooltipTitle).toBe('Testing');
done();
});
});
});
}); });
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