Commit 297edd26 authored by Amy Qualls's avatar Amy Qualls Committed by Vitaly Slobodin

Update tooltips for deploy keys page components

Updates app/assets/javascripts/deploy_keys/components/key.vue to use
the new tooltips instead of the old deprecated ones.
parent 4a7512bd
<script> <script>
import { head, tail } from 'lodash'; import { head, tail } from 'lodash';
import { GlIcon } from '@gitlab/ui'; import { GlIcon, GlTooltipDirective } from '@gitlab/ui';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
import tooltip from '~/vue_shared/directives/tooltip';
import timeagoMixin from '~/vue_shared/mixins/timeago'; import timeagoMixin from '~/vue_shared/mixins/timeago';
import actionBtn from './action_btn.vue'; import actionBtn from './action_btn.vue';
...@@ -13,7 +12,7 @@ export default { ...@@ -13,7 +12,7 @@ export default {
GlIcon, GlIcon,
}, },
directives: { directives: {
tooltip, GlTooltip: GlTooltipDirective,
}, },
mixins: [timeagoMixin], mixins: [timeagoMixin],
props: { props: {
...@@ -125,7 +124,7 @@ export default { ...@@ -125,7 +124,7 @@ export default {
<div class="table-mobile-content deploy-project-list"> <div class="table-mobile-content deploy-project-list">
<template v-if="projects.length > 0"> <template v-if="projects.length > 0">
<a <a
v-tooltip v-gl-tooltip
:title="projectTooltipTitle(firstProject)" :title="projectTooltipTitle(firstProject)"
class="label deploy-project-label" class="label deploy-project-label"
> >
...@@ -134,7 +133,7 @@ export default { ...@@ -134,7 +133,7 @@ export default {
</a> </a>
<a <a
v-if="isExpandable" v-if="isExpandable"
v-tooltip v-gl-tooltip
:title="restProjectsTooltip" :title="restProjectsTooltip"
class="label deploy-project-label" class="label deploy-project-label"
@click="toggleExpanded" @click="toggleExpanded"
...@@ -145,7 +144,7 @@ export default { ...@@ -145,7 +144,7 @@ export default {
v-for="deployKeysProject in restProjects" v-for="deployKeysProject in restProjects"
v-else-if="isExpanded" v-else-if="isExpanded"
:key="deployKeysProject.project.full_path" :key="deployKeysProject.project.full_path"
v-tooltip v-gl-tooltip
:href="deployKeysProject.project.full_path" :href="deployKeysProject.project.full_path"
:title="projectTooltipTitle(deployKeysProject)" :title="projectTooltipTitle(deployKeysProject)"
class="label deploy-project-label" class="label deploy-project-label"
...@@ -160,7 +159,7 @@ export default { ...@@ -160,7 +159,7 @@ export default {
<div class="table-section section-15 text-right"> <div class="table-section section-15 text-right">
<div role="rowheader" class="table-mobile-header">{{ __('Created') }}</div> <div role="rowheader" class="table-mobile-header">{{ __('Created') }}</div>
<div class="table-mobile-content text-secondary key-created-at"> <div class="table-mobile-content text-secondary key-created-at">
<span v-tooltip :title="tooltipTitle(deployKey.created_at)"> <span v-gl-tooltip :title="tooltipTitle(deployKey.created_at)">
<gl-icon name="calendar" /> <span>{{ timeFormatted(deployKey.created_at) }}</span> <gl-icon name="calendar" /> <span>{{ timeFormatted(deployKey.created_at) }}</span>
</span> </span>
</div> </div>
...@@ -172,7 +171,7 @@ export default { ...@@ -172,7 +171,7 @@ export default {
</action-btn> </action-btn>
<a <a
v-if="deployKey.can_edit" v-if="deployKey.can_edit"
v-tooltip v-gl-tooltip
:href="editDeployKeyPath" :href="editDeployKeyPath"
:title="__('Edit')" :title="__('Edit')"
class="btn btn-default text-secondary" class="btn btn-default text-secondary"
...@@ -182,7 +181,7 @@ export default { ...@@ -182,7 +181,7 @@ export default {
</a> </a>
<action-btn <action-btn
v-if="isRemovable" v-if="isRemovable"
v-tooltip v-gl-tooltip
:deploy-key="deployKey" :deploy-key="deployKey"
:title="__('Remove')" :title="__('Remove')"
btn-css-class="btn-danger" btn-css-class="btn-danger"
...@@ -193,7 +192,7 @@ export default { ...@@ -193,7 +192,7 @@ export default {
</action-btn> </action-btn>
<action-btn <action-btn
v-else-if="isEnabled" v-else-if="isEnabled"
v-tooltip v-gl-tooltip
:deploy-key="deployKey" :deploy-key="deployKey"
:title="__('Disable')" :title="__('Disable')"
btn-css-class="btn-warning" btn-css-class="btn-warning"
......
...@@ -79,7 +79,7 @@ describe('Deploy keys key', () => { ...@@ -79,7 +79,7 @@ describe('Deploy keys key', () => {
deployKeysProjects[0] = { ...deployKeysProjects[0], can_push: true }; deployKeysProjects[0] = { ...deployKeysProjects[0], can_push: true };
createComponent({ deployKey: { ...deployKey, deploy_keys_projects: deployKeysProjects } }); createComponent({ deployKey: { ...deployKey, deploy_keys_projects: deployKeysProjects } });
expect(wrapper.find('.deploy-project-label').attributes('data-original-title')).toBe( expect(wrapper.find('.deploy-project-label').attributes('title')).toBe(
'Write access allowed', 'Write access allowed',
); );
}); });
...@@ -88,9 +88,7 @@ describe('Deploy keys key', () => { ...@@ -88,9 +88,7 @@ describe('Deploy keys key', () => {
deployKeysProjects[0] = { ...deployKeysProjects[0], can_push: false }; deployKeysProjects[0] = { ...deployKeysProjects[0], can_push: false };
createComponent({ deployKey: { ...deployKey, deploy_keys_projects: deployKeysProjects } }); createComponent({ deployKey: { ...deployKey, deploy_keys_projects: deployKeysProjects } });
expect(wrapper.find('.deploy-project-label').attributes('data-original-title')).toBe( expect(wrapper.find('.deploy-project-label').attributes('title')).toBe('Read access only');
'Read access only',
);
}); });
it('shows expandable button if more than two projects', () => { it('shows expandable button if more than two projects', () => {
...@@ -99,7 +97,7 @@ describe('Deploy keys key', () => { ...@@ -99,7 +97,7 @@ describe('Deploy keys key', () => {
expect(labels.length).toBe(2); expect(labels.length).toBe(2);
expect(labels.at(1).text()).toContain('others'); expect(labels.at(1).text()).toContain('others');
expect(labels.at(1).attributes('data-original-title')).toContain('Expand'); expect(labels.at(1).attributes('title')).toContain('Expand');
}); });
it('expands all project labels after click', () => { it('expands all project labels after click', () => {
...@@ -115,7 +113,7 @@ describe('Deploy keys key', () => { ...@@ -115,7 +113,7 @@ describe('Deploy keys key', () => {
expect(labels.length).toBe(length); expect(labels.length).toBe(length);
expect(labels.at(1).text()).not.toContain(`+${length} others`); expect(labels.at(1).text()).not.toContain(`+${length} others`);
expect(labels.at(1).attributes('data-original-title')).not.toContain('Expand'); expect(labels.at(1).attributes('title')).not.toContain('Expand');
}); });
}); });
......
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