From fb1c6650abcdbcc69b040841dec537e1e5249db4 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Thu, 1 Feb 2018 18:07:18 +0000 Subject: [PATCH] Fixes after review --- .../components/mr_widget_header.vue | 26 ++++++++++++------- .../components/mr_widget_header_spec.js | 4 +-- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.vue b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.vue index b82026ee1bb..18a3787857d 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.vue @@ -24,7 +24,7 @@ return this.mr.divergedCommitsCount > 0; }, commitsText() { - return n__('commit behind', 'commits behind', this.mr.divergedCommitsCount); + return n__('%d commit behind', '%d commits behind', this.mr.divergedCommitsCount); }, branchNameClipboardData() { // This supports code in app/assets/javascripts/copy_to_clipboard.js that @@ -35,6 +35,12 @@ gfm: `\`${this.mr.sourceBranch}\``, }); }, + isSourceBranchLong() { + return this.isBranchTitleLong(this.mr.sourceBranch); + }, + isTargetBranchLong() { + return this.isBranchTitleLong(this.mr.targetBranch); + }, }, methods: { isBranchTitleLong(branchTitle) { @@ -50,15 +56,15 @@ {{ s__("mrWidget|Request to merge") }} - @@ -67,9 +73,9 @@ - ({{ mr.divergedCommitsCount }} {{ commitsText }}) + ({{ commitsText }}) @@ -93,7 +99,7 @@ data-target="#modal_merge_info" data-toggle="modal" :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" > {{ s__("mrWidget|Check out branch") }} diff --git a/spec/javascripts/vue_mr_widget/components/mr_widget_header_spec.js b/spec/javascripts/vue_mr_widget/components/mr_widget_header_spec.js index 5fb7093a078..13e5595bbfc 100644 --- a/spec/javascripts/vue_mr_widget/components/mr_widget_header_spec.js +++ b/spec/javascripts/vue_mr_widget/components/mr_widget_header_spec.js @@ -47,7 +47,7 @@ describe('MRWidgetHeader', () => { 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', () => { @@ -58,7 +58,7 @@ describe('MRWidgetHeader', () => { targetBranch: 'master', } }); - expect(vm.commitsText).toEqual('commits behind'); + expect(vm.commitsText).toEqual('2 commits behind'); }); }); });