Commit 004307be authored by Phil Hughes's avatar Phil Hughes Committed by GitLab Release Tools Bot

Merge branch '60241-merge-request-popover-doesn-t-go-away-on-mouse-leave' into 'master'

Resolve "Merge Request popover doesn't go away on mouse leave"

Closes #60241

See merge request gitlab-org/gitlab-ce!27143

(cherry picked from commit 9edb5d47)

2ea409f6 Fix bug where MR Popover wont go away
parent f4d3820a
......@@ -54,9 +54,13 @@ export default elements => {
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(),
const listenerAddedAttr = 'data-mr-listener-added';
mrLinks.forEach(el => {
el.addEventListener('mouseenter', handleMRPopoverMount(apolloProvider));
if (!el.getAttribute(listenerAddedAttr)) {
el.addEventListener('mouseenter', handleMRPopoverMount(apolloProvider));
el.setAttribute(listenerAddedAttr, true);
title: Fix bug where MR popover doesn't go away on mouse leave
type: fixed
import * as createDefaultClient from '~/lib/graphql';
import { setHTMLFixture } from '../helpers/fixtures';
import initMRPopovers from '~/mr_popover/index';
createDefaultClient.default = jest.fn();
describe('initMRPopovers', () => {
let mr1;
let mr2;
beforeEach(() => {
<div id="one" class="gfm-merge_request">MR1</div>
<div id="two" class="gfm-merge_request">MR2</div>
mr1 = document.querySelector('#one');
mr2 = document.querySelector('#two');
mr1.addEventListener = jest.fn();
mr2.addEventListener = jest.fn();
it('does not add the same event listener twice', () => {
initMRPopovers([mr1, mr1, mr2]);
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