Commit 4576a4cb authored by Phil Hughes's avatar Phil Hughes

Merge branch 'mr-widget-service-endpoints-method' into 'master'

Extract extension method from mr_widget_options

See merge request gitlab-org/gitlab-ee!9411
parents 982c1125 74992099
......@@ -142,8 +142,8 @@ export default {
}
},
methods: {
createService(store) {
const endpoints = {
getServiceEndpoints(store) {
return {
mergePath: store.mergePath,
mergeCheckPath: store.mergeCheckPath,
cancelAutoMergePath: store.cancelAutoMergePath,
......@@ -153,9 +153,10 @@ export default {
statusPath: store.statusPath,
mergeActionsContentPath: store.mergeActionsContentPath,
rebasePath: store.rebasePath,
approvalsPath: store.approvalsPath,
};
return new MRWidgetService(endpoints);
},
createService(store) {
return new MRWidgetService(this.getServiceEndpoints(store));
},
checkStatus(cb, isRebased) {
return this.service
......
......@@ -138,6 +138,14 @@ export default {
}
},
methods: {
getServiceEndpoints(store) {
const base = CEWidgetOptions.methods.getServiceEndpoints(store);
return {
...base,
approvalsPath: store.approvalsPath,
};
},
fetchCodeQuality() {
const { head_path, base_path } = this.mr.codeclimate;
......
......@@ -846,4 +846,18 @@ describe('ee merge request widget options', () => {
expect(ciWidget).toContainHtml(sourceBranchLink);
});
});
describe('data', () => {
it('passes approvals_path to service', () => {
const approvalsPath = `${TEST_HOST}/approvals/path`;
vm = mountComponent(Component, {
mrData: {
...mockData,
approvals_path: approvalsPath,
},
});
expect(vm.service.approvalsPath).toEqual(approvalsPath);
});
});
});
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