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 { ...@@ -142,8 +142,8 @@ export default {
} }
}, },
methods: { methods: {
createService(store) { getServiceEndpoints(store) {
const endpoints = { return {
mergePath: store.mergePath, mergePath: store.mergePath,
mergeCheckPath: store.mergeCheckPath, mergeCheckPath: store.mergeCheckPath,
cancelAutoMergePath: store.cancelAutoMergePath, cancelAutoMergePath: store.cancelAutoMergePath,
...@@ -153,9 +153,10 @@ export default { ...@@ -153,9 +153,10 @@ export default {
statusPath: store.statusPath, statusPath: store.statusPath,
mergeActionsContentPath: store.mergeActionsContentPath, mergeActionsContentPath: store.mergeActionsContentPath,
rebasePath: store.rebasePath, rebasePath: store.rebasePath,
approvalsPath: store.approvalsPath,
}; };
return new MRWidgetService(endpoints); },
createService(store) {
return new MRWidgetService(this.getServiceEndpoints(store));
}, },
checkStatus(cb, isRebased) { checkStatus(cb, isRebased) {
return this.service return this.service
......
...@@ -138,6 +138,14 @@ export default { ...@@ -138,6 +138,14 @@ export default {
} }
}, },
methods: { methods: {
getServiceEndpoints(store) {
const base = CEWidgetOptions.methods.getServiceEndpoints(store);
return {
...base,
approvalsPath: store.approvalsPath,
};
},
fetchCodeQuality() { fetchCodeQuality() {
const { head_path, base_path } = this.mr.codeclimate; const { head_path, base_path } = this.mr.codeclimate;
......
...@@ -846,4 +846,18 @@ describe('ee merge request widget options', () => { ...@@ -846,4 +846,18 @@ describe('ee merge request widget options', () => {
expect(ciWidget).toContainHtml(sourceBranchLink); 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