Commit 068f9df2 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'ce-backport-39009-fix-approvals-showing-up-in-empty-mr-widget' into 'master'

Remove approvals when in empty MR widget state -- CE backport

See merge request gitlab-org/gitlab-ce!15362
parents 8ee3ea74 81862c2d
......@@ -61,7 +61,7 @@ export default {
return this.mr.hasCI;
},
shouldRenderRelatedLinks() {
return this.mr.relatedLinks;
return !!this.mr.relatedLinks;
},
shouldRenderDeployments() {
return this.mr.deployments.length;
......
......@@ -3,13 +3,7 @@ import mrWidgetOptions from '~/vue_merge_request_widget/mr_widget_options';
import eventHub from '~/vue_merge_request_widget/event_hub';
import notify from '~/lib/utils/notify';
import mockData from './mock_data';
const createComponent = () => {
delete mrWidgetOptions.el; // Prevent component mounting
gl.mrWidgetData = mockData;
const Component = Vue.extend(mrWidgetOptions);
return new Component();
};
import mountComponent from '../helpers/vue_mount_component_helper';
const returnPromise = data => new Promise((resolve) => {
resolve({
......@@ -22,9 +16,16 @@ const returnPromise = data => new Promise((resolve) => {
describe('mrWidgetOptions', () => {
let vm;
let MrWidgetOptions;
beforeEach(() => {
vm = createComponent();
// Prevent component mounting
delete mrWidgetOptions.el;
MrWidgetOptions = Vue.extend(mrWidgetOptions);
vm = mountComponent(MrWidgetOptions, {
mrData: { ...mockData },
});
});
describe('data', () => {
......@@ -77,7 +78,7 @@ describe('mrWidgetOptions', () => {
});
it('should return true if there is relatedLinks in MR', () => {
vm.mr.relatedLinks = {};
Vue.set(vm.mr, 'relatedLinks', {});
expect(vm.shouldRenderRelatedLinks).toBeTruthy();
});
});
......
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