Commit 81862c2d authored by Eric Eastwood's avatar Eric Eastwood

Backport spec changes from EE remove approvals in empty state

See https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/3376
parent 6ffb9ffd
......@@ -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