Commit 700d31da authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents 9a322940 55767af4
...@@ -119,7 +119,8 @@ export default { ...@@ -119,7 +119,8 @@ export default {
}, },
showTargetBranchAdvancedError() { showTargetBranchAdvancedError() {
return Boolean( return Boolean(
this.mr.pipeline && this.mr.isOpen &&
this.mr.pipeline &&
this.mr.pipeline.target_sha && this.mr.pipeline.target_sha &&
this.mr.pipeline.target_sha !== this.mr.targetBranchSha, this.mr.pipeline.target_sha !== this.mr.targetBranchSha,
); );
......
...@@ -22,6 +22,7 @@ import noteHeader from '~/notes/components/note_header.vue'; ...@@ -22,6 +22,7 @@ import noteHeader from '~/notes/components/note_header.vue';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import TimelineEntryItem from './timeline_entry_item.vue'; import TimelineEntryItem from './timeline_entry_item.vue';
import { spriteIcon } from '../../../lib/utils/common_utils'; import { spriteIcon } from '../../../lib/utils/common_utils';
import initMRPopovers from '~/mr_popover/';
const MAX_VISIBLE_COMMIT_LIST_COUNT = 3; const MAX_VISIBLE_COMMIT_LIST_COUNT = 3;
...@@ -71,6 +72,9 @@ export default { ...@@ -71,6 +72,9 @@ export default {
); );
}, },
}, },
mounted() {
initMRPopovers(this.$el.querySelectorAll('.gfm-merge_request'));
},
}; };
</script> </script>
......
---
title: Only show the "target branch has advanced" message when the merge request is
open
merge_request: 27588
author:
type: fixed
---
title: Fix bug where system note MR has no popover
merge_request: 27589
author:
type: fixed
...@@ -5,8 +5,10 @@ import createStore from '~/notes/stores'; ...@@ -5,8 +5,10 @@ import createStore from '~/notes/stores';
describe('system note component', () => { describe('system note component', () => {
let vm; let vm;
let props; let props;
let initMRPopoversSpy;
beforeEach(() => { beforeEach(() => {
initMRPopoversSpy = spyOnDependency(issueSystemNote, 'initMRPopovers');
props = { props = {
note: { note: {
id: '1424', id: '1424',
...@@ -56,4 +58,8 @@ describe('system note component', () => { ...@@ -56,4 +58,8 @@ describe('system note component', () => {
it('removes wrapping paragraph from note HTML', () => { it('removes wrapping paragraph from note HTML', () => {
expect(vm.$el.querySelector('.system-note-message').innerHTML).toEqual('<span>closed</span>'); expect(vm.$el.querySelector('.system-note-message').innerHTML).toEqual('<span>closed</span>');
}); });
it('should initMRPopovers onMount', () => {
expect(initMRPopoversSpy).toHaveBeenCalled();
});
}); });
...@@ -228,6 +228,7 @@ describe('mrWidgetOptions', () => { ...@@ -228,6 +228,7 @@ describe('mrWidgetOptions', () => {
describe('showTargetBranchAdvancedError', () => { describe('showTargetBranchAdvancedError', () => {
describe(`when the pipeline's target_sha property doesn't exist`, () => { describe(`when the pipeline's target_sha property doesn't exist`, () => {
beforeEach(done => { beforeEach(done => {
Vue.set(vm.mr, 'isOpen', true);
Vue.set(vm.mr.pipeline, 'target_sha', undefined); Vue.set(vm.mr.pipeline, 'target_sha', undefined);
Vue.set(vm.mr, 'targetBranchSha', 'abcd'); Vue.set(vm.mr, 'targetBranchSha', 'abcd');
vm.$nextTick(done); vm.$nextTick(done);
...@@ -240,6 +241,7 @@ describe('mrWidgetOptions', () => { ...@@ -240,6 +241,7 @@ describe('mrWidgetOptions', () => {
describe(`when the pipeline's target_sha matches the target branch's sha`, () => { describe(`when the pipeline's target_sha matches the target branch's sha`, () => {
beforeEach(done => { beforeEach(done => {
Vue.set(vm.mr, 'isOpen', true);
Vue.set(vm.mr.pipeline, 'target_sha', 'abcd'); Vue.set(vm.mr.pipeline, 'target_sha', 'abcd');
Vue.set(vm.mr, 'targetBranchSha', 'abcd'); Vue.set(vm.mr, 'targetBranchSha', 'abcd');
vm.$nextTick(done); vm.$nextTick(done);
...@@ -250,8 +252,22 @@ describe('mrWidgetOptions', () => { ...@@ -250,8 +252,22 @@ describe('mrWidgetOptions', () => {
}); });
}); });
describe(`when the merge request is not open`, () => {
beforeEach(done => {
Vue.set(vm.mr, 'isOpen', false);
Vue.set(vm.mr.pipeline, 'target_sha', 'abcd');
Vue.set(vm.mr, 'targetBranchSha', 'bcde');
vm.$nextTick(done);
});
it('should be false', () => {
expect(vm.showTargetBranchAdvancedError).toEqual(false);
});
});
describe(`when the pipeline's target_sha does not match the target branch's sha`, () => { describe(`when the pipeline's target_sha does not match the target branch's sha`, () => {
beforeEach(done => { beforeEach(done => {
Vue.set(vm.mr, 'isOpen', true);
Vue.set(vm.mr.pipeline, 'target_sha', 'abcd'); Vue.set(vm.mr.pipeline, 'target_sha', 'abcd');
Vue.set(vm.mr, 'targetBranchSha', 'bcde'); Vue.set(vm.mr, 'targetBranchSha', 'bcde');
vm.$nextTick(done); vm.$nextTick(done);
......
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