Merge branch '60855-mr-popover-is-not-attached-in-system-notes-jest-fix' into 'master'

Init MR Popovers on system note mounted

Closes #60855

See merge request gitlab-org/gitlab-ce!27747
This commit is contained in:
Filipa Lacerda 2019-04-29 09:16:03 +00:00
commit 7d29dbe49d
3 changed files with 16 additions and 0 deletions

View file

@ -22,6 +22,7 @@ import noteHeader from '~/notes/components/note_header.vue';
import Icon from '~/vue_shared/components/icon.vue';
import TimelineEntryItem from './timeline_entry_item.vue';
import { spriteIcon } from '../../../lib/utils/common_utils';
import initMRPopovers from '~/mr_popover/';
const MAX_VISIBLE_COMMIT_LIST_COUNT = 3;
@ -71,6 +72,9 @@ export default {
);
},
},
mounted() {
initMRPopovers(this.$el.querySelectorAll('.gfm-merge_request'));
},
};
</script>

View file

@ -0,0 +1,5 @@
---
title: Fix bug where system note MR has no popover
merge_request: 27747
author:
type: fixed

View file

@ -1,6 +1,9 @@
import Vue from 'vue';
import issueSystemNote from '~/vue_shared/components/notes/system_note.vue';
import createStore from '~/notes/stores';
import initMRPopovers from '~/mr_popover/index';
jest.mock('~/mr_popover/index', () => jest.fn());
describe('system note component', () => {
let vm;
@ -56,4 +59,8 @@ describe('system note component', () => {
it('removes wrapping paragraph from note HTML', () => {
expect(vm.$el.querySelector('.system-note-message').innerHTML).toEqual('<span>closed</span>');
});
it('should initMRPopovers onMount', () => {
expect(initMRPopovers).toHaveBeenCalled();
});
});