Commit 7d541da8 authored by peterhegman's avatar peterhegman

Add test for author status tooltip

Check to ensure duplicate tooltips are not shown
parent 6236715e
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount, createLocalVue } from '@vue/test-utils';
import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import NoteHeader from '~/notes/components/note_header.vue'; import NoteHeader from '~/notes/components/note_header.vue';
import GitlabTeamMemberBadge from '~/vue_shared/components/user_avatar/badges/gitlab_team_member_badge.vue'; import GitlabTeamMemberBadge from '~/vue_shared/components/user_avatar/badges/gitlab_team_member_badge.vue';
...@@ -201,4 +202,23 @@ describe('NoteHeader component', () => { ...@@ -201,4 +202,23 @@ describe('NoteHeader component', () => {
expect(dispatchEvent).toHaveBeenCalledWith(new Event('mouseleave')); expect(dispatchEvent).toHaveBeenCalledWith(new Event('mouseleave'));
}); });
}); });
describe('when author status tooltip is opened', () => {
it('removes `title` attribute from emoji to prevent duplicate tooltips', () => {
createComponent({
author: {
...author,
status_tooltip_html:
'"<span class="user-status-emoji has-tooltip" title="foo bar" data-html="true" data-placement="top"><gl-emoji title="basketball and hoop" data-name="basketball" data-unicode-version="6.0">🏀</gl-emoji></span>"',
},
});
return Vue.nextTick().then(() => {
const authorStatus = wrapper.find({ ref: 'authorStatus' });
authorStatus.trigger('mouseenter');
expect(authorStatus.find('gl-emoji').attributes('title')).toBeUndefined();
});
});
});
}); });
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