Commit fb1c6650 authored by Filipa Lacerda's avatar Filipa Lacerda

Fixes after review

parent e03c85b9
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
return this.mr.divergedCommitsCount > 0; return this.mr.divergedCommitsCount > 0;
}, },
commitsText() { commitsText() {
return n__('commit behind', 'commits behind', this.mr.divergedCommitsCount); return n__('%d commit behind', '%d commits behind', this.mr.divergedCommitsCount);
}, },
branchNameClipboardData() { branchNameClipboardData() {
// This supports code in app/assets/javascripts/copy_to_clipboard.js that // This supports code in app/assets/javascripts/copy_to_clipboard.js that
...@@ -35,6 +35,12 @@ ...@@ -35,6 +35,12 @@
gfm: `\`${this.mr.sourceBranch}\``, gfm: `\`${this.mr.sourceBranch}\``,
}); });
}, },
isSourceBranchLong() {
return this.isBranchTitleLong(this.mr.sourceBranch);
},
isTargetBranchLong() {
return this.isBranchTitleLong(this.mr.targetBranch);
},
}, },
methods: { methods: {
isBranchTitleLong(branchTitle) { isBranchTitleLong(branchTitle) {
...@@ -50,15 +56,15 @@ ...@@ -50,15 +56,15 @@
{{ s__("mrWidget|Request to merge") }} {{ s__("mrWidget|Request to merge") }}
<span <span
class="label-branch js-source-branch" class="label-branch js-source-branch"
:class="{ 'label-truncated': isBranchTitleLong(mr.sourceBranch) }" :class="{ 'label-truncated': isSourceBranchLong }"
:title="isBranchTitleLong(mr.sourceBranch) ? mr.sourceBranch : ''" :title="isSourceBranchLong ? mr.sourceBranch : ''"
data-placement="bottom" data-placement="bottom"
:v-tooltip="isBranchTitleLong(mr.sourceBranch)" :v-tooltip="isSourceBranchLong"
v-html="mr.sourceBranchLink" v-html="mr.sourceBranchLink"
> >
</span> </span>
<clipboardButton <clipboard-button
:text="branchNameClipboardData" :text="branchNameClipboardData"
:title="__('Copy branch name to clipboard')" :title="__('Copy branch name to clipboard')"
/> />
...@@ -67,9 +73,9 @@ ...@@ -67,9 +73,9 @@
<span <span
class="label-branch" class="label-branch"
:v-tooltip="isBranchTitleLong(mr.sourceBranch)" :v-tooltip="isTargetBranchLong"
:class="{ 'label-truncatedtooltip': isBranchTitleLong(mr.targetBranch) }" :class="{ 'label-truncatedtooltip': isTargetBranchLong }"
:title="isBranchTitleLong(mr.targetBranch) ? mr.targetBranch : ''" :title="isTargetBranchLong ? mr.targetBranch : ''"
data-placement="bottom" data-placement="bottom"
> >
<a <a
...@@ -84,7 +90,7 @@ ...@@ -84,7 +90,7 @@
v-if="shouldShowCommitsBehindText" v-if="shouldShowCommitsBehindText"
class="diverged-commits-count" class="diverged-commits-count"
> >
(<a :href="mr.targetBranchPath">{{ mr.divergedCommitsCount }} {{ commitsText }}</a>) (<a :href="mr.targetBranchPath">{{ commitsText }}</a>)
</span> </span>
</div> </div>
...@@ -93,7 +99,7 @@ ...@@ -93,7 +99,7 @@
data-target="#modal_merge_info" data-target="#modal_merge_info"
data-toggle="modal" data-toggle="modal"
:disabled="mr.sourceBranchRemoved" :disabled="mr.sourceBranchRemoved"
class="btn btn-sm inline js-check-out-branch" class="btn btn-sm btn-default inline js-check-out-branch"
type="button" type="button"
> >
{{ s__("mrWidget|Check out branch") }} {{ s__("mrWidget|Check out branch") }}
......
...@@ -47,7 +47,7 @@ describe('MRWidgetHeader', () => { ...@@ -47,7 +47,7 @@ describe('MRWidgetHeader', () => {
targetBranch: 'master', targetBranch: 'master',
} }); } });
expect(vm.commitsText).toEqual('commit behind'); expect(vm.commitsText).toEqual('1 commit behind');
}); });
it('returns plural when there is more than one commit', () => { it('returns plural when there is more than one commit', () => {
...@@ -58,7 +58,7 @@ describe('MRWidgetHeader', () => { ...@@ -58,7 +58,7 @@ describe('MRWidgetHeader', () => {
targetBranch: 'master', targetBranch: 'master',
} }); } });
expect(vm.commitsText).toEqual('commits behind'); expect(vm.commitsText).toEqual('2 commits behind');
}); });
}); });
}); });
......
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