summaryrefslogtreecommitdiffstats
path: root/test/helpers/reactions_helper_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/helpers/reactions_helper_test.rb')
-rw-r--r--test/helpers/reactions_helper_test.rb32
1 files changed, 26 insertions, 6 deletions
diff --git a/test/helpers/reactions_helper_test.rb b/test/helpers/reactions_helper_test.rb
index f3a4e38d8..f2eb04b6d 100644
--- a/test/helpers/reactions_helper_test.rb
+++ b/test/helpers/reactions_helper_test.rb
@@ -106,12 +106,30 @@ class ReactionsHelperTest < ActionView::TestCase
assert_select_in result, 'a.reaction-button[title=?]', expected_tooltip
end
- test 'reaction_button displays non-visible users as "X other" in the tooltip' do
+ test 'reaction_button should be label less when no reactions' do
+ issue = issues(:issues_002)
+
+ result = with_locale('en') do
+ reaction_button(issue)
+ end
+ assert_select_in result, 'a.reaction-button' do
+ assert_select 'span.icon-label', false
+ end
+
+ # readonly
+ User.current = nil
+ result = with_locale('en') do
+ reaction_button(issue)
+ end
+ assert_select_in result, 'span.reaction-button.readonly' do
+ assert_select 'span.icon-label', false
+ end
+ end
+
+ test 'reaction_button should not count and display non-visible users' do
issue2 = issues(:issues_002)
issue2.reaction_detail = Reaction::Detail.new(
- # The remaining 3 users are non-visible users
- reaction_count: 5,
visible_users: users(:users_002, :users_003)
)
@@ -119,11 +137,10 @@ class ReactionsHelperTest < ActionView::TestCase
reaction_button(issue2)
end
- assert_select_in result, 'a.reaction-button[title=?]', 'John Smith, Dave Lopper, and 3 others'
+ assert_select_in result, 'a.reaction-button[title=?]', 'John Smith and Dave Lopper'
# When all users are non-visible users
issue2.reaction_detail = Reaction::Detail.new(
- reaction_count: 2,
visible_users: []
)
@@ -131,7 +148,10 @@ class ReactionsHelperTest < ActionView::TestCase
reaction_button(issue2)
end
- assert_select_in result, 'a.reaction-button[title=?]', '2 others'
+ assert_select_in result, 'a.reaction-button[title]', false
+ assert_select_in result, 'a.reaction-button' do
+ assert_select 'span.icon-label', false
+ end
end
test 'reaction_button formats the tooltip content based on the support.array settings of each locale' do