Commit 5d7d5098 authored by Fatih Acet's avatar Fatih Acet

MRWidget: Fix target branch link.

parent e7b53dd6
...@@ -16,7 +16,7 @@ export default { ...@@ -16,7 +16,7 @@ export default {
The changes will be merged into The changes will be merged into
<span class="label-branch"> <span class="label-branch">
<a :href="mr.targetBranchPath">{{mr.targetBranch}}</a> <a :href="mr.targetBranchPath">{{mr.targetBranch}}</a>
</span> </span>.
</p> </p>
</section> </section>
</div> </div>
......
...@@ -87,7 +87,7 @@ export default { ...@@ -87,7 +87,7 @@ export default {
:href="mr.targetBranchPath" :href="mr.targetBranchPath"
class="label-branch"> class="label-branch">
{{mr.targetBranch}} {{mr.targetBranch}}
</a> </a>.
</p> </p>
<p v-if="mr.shouldRemoveSourceBranch"> <p v-if="mr.shouldRemoveSourceBranch">
The source branch will be removed. The source branch will be removed.
......
...@@ -43,6 +43,7 @@ export default class MergeRequestStore { ...@@ -43,6 +43,7 @@ export default class MergeRequestStore {
this.mergeUserId = data.merge_user_id; this.mergeUserId = data.merge_user_id;
this.currentUserId = gon.current_user_id; this.currentUserId = gon.current_user_id;
this.sourceBranchPath = data.source_branch_path; this.sourceBranchPath = data.source_branch_path;
this.targetBranchCommitsPath = data.target_branch_commits_path;
this.sourceBranchLink = data.source_branch_with_namespace_link; this.sourceBranchLink = data.source_branch_with_namespace_link;
this.mergeError = data.merge_error; this.mergeError = data.merge_error;
this.targetBranchPath = data.target_branch_commits_path; this.targetBranchPath = data.target_branch_commits_path;
......
...@@ -48,10 +48,12 @@ describe('MRWidgetHeader', () => { ...@@ -48,10 +48,12 @@ describe('MRWidgetHeader', () => {
describe('template', () => { describe('template', () => {
let vm; let vm;
let el; let el;
const sourceBranchPath = '/foo/bar/mr-widget-refactor';
const mr = { const mr = {
divergedCommitsCount: 12, divergedCommitsCount: 12,
sourceBranch: 'mr-widget-refactor', sourceBranch: 'mr-widget-refactor',
sourceBranchLink: '/foo/bar/mr-widget-refactor', sourceBranchLink: `<a href="${sourceBranchPath}">mr-widget-refactor</a>`,
targetBranchCommitsPath: 'foo/bar/commits-path',
targetBranch: 'master', targetBranch: 'master',
isOpen: true, isOpen: true,
emailPatchesPath: '/mr/email-patches', emailPatchesPath: '/mr/email-patches',
...@@ -65,8 +67,13 @@ describe('MRWidgetHeader', () => { ...@@ -65,8 +67,13 @@ describe('MRWidgetHeader', () => {
it('should render template elements correctly', () => { it('should render template elements correctly', () => {
expect(el.classList.contains('mr-source-target')).toBeTruthy(); expect(el.classList.contains('mr-source-target')).toBeTruthy();
expect(el.querySelectorAll('.label-branch')[0].textContent).toContain(mr.sourceBranch); const sourceBranchLink = el.querySelectorAll('.label-branch')[0];
expect(el.querySelectorAll('.label-branch')[1].textContent).toContain(mr.targetBranch); const targetBranchLink = el.querySelectorAll('.label-branch')[1];
expect(sourceBranchLink.textContent).toContain(mr.sourceBranch);
expect(targetBranchLink.textContent).toContain(mr.targetBranch);
expect(sourceBranchLink.querySelector('a').getAttribute('href')).toEqual(sourceBranchPath);
expect(targetBranchLink.querySelector('a').getAttribute('href')).toEqual(mr.targetBranchCommitsPath);
expect(el.querySelector('.diverged-commits-count').textContent).toContain('12 commits behind'); expect(el.querySelector('.diverged-commits-count').textContent).toContain('12 commits behind');
expect(el.textContent).toContain('Check out branch'); expect(el.textContent).toContain('Check out branch');
......
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