summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Ho <clemmakesapps@gmail.com>2017-01-09 18:07:42 +0000
committerClement Ho <clemmakesapps@gmail.com>2017-01-09 18:07:42 +0000
commit8bacc5bc7e69e95304045a449c69cdd37ac6d5b1 (patch)
tree80e84879d7cd4ebebcfd1eb4ea654e98b7a35008
parent2a5e63a8e34300f04bb2f5912e6595210ea4b16c (diff)
parent37bbdb604c89ce3a17ad56eb03bf3c8d5be3bc4f (diff)
downloadgitlab-ce-8bacc5bc7e69e95304045a449c69cdd37ac6d5b1.tar.gz
Merge branch 'ryancharris/gitlab-ce-25277-milestone-counter-number-with-delimiter' into 'master'
View spec for Ryancharris/gitlab milestone counter number with delimiter See merge request !8482
-rw-r--r--app/views/shared/milestones/_issuables.html.haml1
-rw-r--r--changelogs/unreleased/25277-milestone-counter-number-with-delimiter.yml4
-rw-r--r--spec/views/shared/milestones/_issuables.html.haml.rb32
3 files changed, 37 insertions, 0 deletions
diff --git a/app/views/shared/milestones/_issuables.html.haml b/app/views/shared/milestones/_issuables.html.haml
index 15ff5b8a27e..c8fd45c4319 100644
--- a/app/views/shared/milestones/_issuables.html.haml
+++ b/app/views/shared/milestones/_issuables.html.haml
@@ -9,6 +9,7 @@
- if show_counter
.right
= issuables.size
+ .pull-right= number_with_delimiter(issuables.size)
- class_prefix = dom_class(issuables).pluralize
%ul{ class: "well-list #{class_prefix}-sortable-list", id: "#{class_prefix}-list-#{id}", "data-state" => id }
diff --git a/changelogs/unreleased/25277-milestone-counter-number-with-delimiter.yml b/changelogs/unreleased/25277-milestone-counter-number-with-delimiter.yml
new file mode 100644
index 00000000000..0c9853de3b6
--- /dev/null
+++ b/changelogs/unreleased/25277-milestone-counter-number-with-delimiter.yml
@@ -0,0 +1,4 @@
+---
+title: Added number_with_delimiter to counter on milestone panels
+merge_request:
+author: Ryan Harris
diff --git a/spec/views/shared/milestones/_issuables.html.haml.rb b/spec/views/shared/milestones/_issuables.html.haml.rb
new file mode 100644
index 00000000000..4769d569548
--- /dev/null
+++ b/spec/views/shared/milestones/_issuables.html.haml.rb
@@ -0,0 +1,32 @@
+require 'spec_helper'
+
+describe 'shared/milestones/_issuables.html.haml' do
+ let(:issuables_size) { 100 }
+
+ before do
+ allow(view).to receive_messages(title: nil, id: nil, show_project_name: nil,
+ show_full_project_name: nil, dom_class: '',
+ issuables: double(size: issuables_size).as_null_object)
+
+ stub_template 'shared/milestones/_issuable.html.haml' => ''
+ end
+
+ it 'should show the issuables count if show_counter is true' do
+ render 'shared/milestones/issuables', show_counter: true
+ expect(rendered).to have_content('100')
+ end
+
+ it 'should not show the issuables count if show_counter is false' do
+ render 'shared/milestones/issuables', show_counter: false
+ expect(rendered).not_to have_content('100')
+ end
+
+ describe 'a high issuables count' do
+ let(:issuables_size) { 1000 }
+
+ it 'should show a delimited number if show_counter is true' do
+ render 'shared/milestones/issuables', show_counter: true
+ expect(rendered).to have_content('1,000')
+ end
+ end
+end