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