Commit f3715e33 authored by Brandon Labuschagne's avatar Brandon Labuschagne

Merge branch...

Merge branch '229004-replace-vue_shared-tooltip-with-gitlab-ui-s-tooltip-in-ee-app-assets-javascripts-vue_shared' into 'master'

Resolve "Replace vue_shared with GitLab UI’s tooltip in components/linked_pipelines_mini_list.vue"

Closes #229004

See merge request gitlab-org/gitlab!43822
parents e601d349 fa5c3657
<script> <script>
import { GlIcon } from '@gitlab/ui'; import { GlIcon, GlTooltipDirective } from '@gitlab/ui';
import { sprintf, s__ } from '~/locale'; import { sprintf, s__ } from '~/locale';
import tooltip from '~/vue_shared/directives/tooltip';
export default { export default {
directives: { directives: {
tooltip, GlTooltip: GlTooltipDirective,
}, },
components: { components: {
GlIcon, GlIcon,
...@@ -91,25 +90,20 @@ export default { ...@@ -91,25 +90,20 @@ export default {
<a <a
v-for="pipeline in linkedPipelinesTrimmed" v-for="pipeline in linkedPipelinesTrimmed"
:key="pipeline.id" :key="pipeline.id"
v-tooltip v-gl-tooltip="{ title: pipelineTooltipText(pipeline) }"
:href="pipeline.path" :href="pipeline.path"
:title="pipelineTooltipText(pipeline)"
:class="triggerButtonClass(pipeline.details.status.group)" :class="triggerButtonClass(pipeline.details.status.group)"
class="linked-pipeline-mini-item" class="linked-pipeline-mini-item"
data-placement="top"
data-container="body"
> >
<gl-icon :name="getStatusIcon(pipeline.details.status.icon)" /> <gl-icon :name="getStatusIcon(pipeline.details.status.icon)" />
</a> </a>
<a <a
v-if="shouldRenderCounter" v-if="shouldRenderCounter"
v-tooltip v-gl-tooltip="{ title: counterTooltipText }"
:title="counterTooltipText" :title="counterTooltipText"
:href="pipelinePath" :href="pipelinePath"
class="linked-pipelines-counter linked-pipeline-mini-item" class="linked-pipelines-counter linked-pipeline-mini-item"
data-placement="top"
data-container="body"
> >
{{ counterLabel }} {{ counterLabel }}
</a> </a>
......
import Vue from 'vue'; import Vue from 'vue';
import LinkedPipelinesMiniList from 'ee/vue_shared/components/linked_pipelines_mini_list.vue'; import LinkedPipelinesMiniList from 'ee/vue_shared/components/linked_pipelines_mini_list.vue';
import { createMockDirective, getBinding } from 'helpers/vue_mock_directive';
import mockData from './linked_pipelines_mock_data'; import mockData from './linked_pipelines_mock_data';
const ListComponent = Vue.extend(LinkedPipelinesMiniList); const ListComponent = Vue.extend(LinkedPipelinesMiniList);
...@@ -13,6 +14,9 @@ describe('Linked pipeline mini list', () => { ...@@ -13,6 +14,9 @@ describe('Linked pipeline mini list', () => {
propsData: { propsData: {
triggeredBy: [mockData.triggered_by], triggeredBy: [mockData.triggered_by],
}, },
directives: {
GlTooltip: createMockDirective(),
},
}).$mount(); }).$mount();
}); });
...@@ -46,8 +50,9 @@ describe('Linked pipeline mini list', () => { ...@@ -46,8 +50,9 @@ describe('Linked pipeline mini list', () => {
it('should have an activated tooltip', () => { it('should have an activated tooltip', () => {
const itemElement = component.$el.querySelector('.linked-pipeline-mini-item'); const itemElement = component.$el.querySelector('.linked-pipeline-mini-item');
const tooltip = getBinding(itemElement, 'gl-tooltip');
expect(itemElement.getAttribute('data-original-title')).toBe('GitLabCE - running'); expect(tooltip.value.title).toBe('GitLabCE - running');
}); });
it('should correctly set is-upstream', () => { it('should correctly set is-upstream', () => {
...@@ -70,6 +75,9 @@ describe('Linked pipeline mini list', () => { ...@@ -70,6 +75,9 @@ describe('Linked pipeline mini list', () => {
triggered: mockData.triggered, triggered: mockData.triggered,
pipelinePath: 'my/pipeline/path', pipelinePath: 'my/pipeline/path',
}, },
directives: {
GlTooltip: createMockDirective(),
},
}).$mount(); }).$mount();
}); });
...@@ -100,8 +108,9 @@ describe('Linked pipeline mini list', () => { ...@@ -100,8 +108,9 @@ describe('Linked pipeline mini list', () => {
it('should have prepped tooltips', () => { it('should have prepped tooltips', () => {
const itemElement = component.$el.querySelectorAll('.linked-pipeline-mini-item')[2]; const itemElement = component.$el.querySelectorAll('.linked-pipeline-mini-item')[2];
const tooltip = getBinding(itemElement, 'gl-tooltip');
expect(itemElement.getAttribute('data-original-title')).toBe('GitLabCE - running'); expect(tooltip.value.title).toBe('GitLabCE - running');
}); });
it('should correctly set is-downstream', () => { it('should correctly set is-downstream', () => {
...@@ -128,11 +137,10 @@ describe('Linked pipeline mini list', () => { ...@@ -128,11 +137,10 @@ describe('Linked pipeline mini list', () => {
}); });
it('should render the correct counterTooltipText', () => { it('should render the correct counterTooltipText', () => {
expect( const counter = component.$el.querySelector('.linked-pipelines-counter');
component.$el const tooltip = getBinding(counter, 'gl-tooltip');
.querySelector('.linked-pipelines-counter')
.getAttribute('data-original-title'), expect(tooltip.value.title).toBe(component.counterTooltipText);
).toBe(component.counterTooltipText);
}); });
}); });
}); });
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