summaryrefslogtreecommitdiffstats
path: root/test/helpers/application_helper_test.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2020-03-31 09:30:47 +0000
committerGo MAEDA <maeda@farend.jp>2020-03-31 09:30:47 +0000
commite04fb3e78b318e5919671980dccfe53600ea151c (patch)
treea123acb346653fd6563ac13f9fa8b3dc5450bba6 /test/helpers/application_helper_test.rb
parentbb7c49e05ad50fc3c9ed9b21c99bbef3cb70106c (diff)
downloadredmine-e04fb3e78b318e5919671980dccfe53600ea151c.tar.gz
redmine-e04fb3e78b318e5919671980dccfe53600ea151c.zip
Display avatar on add watchar dialog (#32976).
Patch by Takenori TAKAKI. git-svn-id: http://svn.redmine.org/redmine/trunk@19626 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/helpers/application_helper_test.rb')
-rw-r--r--test/helpers/application_helper_test.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb
index 81e20c1b6..d076aba86 100644
--- a/test/helpers/application_helper_test.rb
+++ b/test/helpers/application_helper_test.rb
@@ -22,6 +22,7 @@ require File.expand_path('../../test_helper', __FILE__)
class ApplicationHelperTest < Redmine::HelperTest
include ERB::Util
include Rails.application.routes.url_helpers
+ include AvatarsHelper
fixtures :projects, :enabled_modules,
:users, :email_addresses,
@@ -1704,6 +1705,31 @@ class ApplicationHelperTest < Redmine::HelperTest
end
end
+ def test_principals_check_box_tag_with_avatar
+ principals = [User.find(1), Group.find(10)]
+ with_settings :gravatar_enabled => '1' do
+ tags = principals_check_box_tags("watcher[user_ids][]", principals)
+ principals.each do |principal|
+ assert_include avatar(principal, :size => 16), tags
+ assert_not_include content_tag('span', nil, :class => "name icon icon-#{principal.class.name.downcase}"), tags
+ end
+ end
+ end
+
+ def test_principals_check_box_tag_without_avatar
+ principals = [User.find(1), Group.find(10)]
+ Setting.gravatar_enabled = '1'
+ avatar_tags = principals.collect{|p| avatar(p, :size => 16) }
+
+ with_settings :gravatar_enabled => '0' do
+ tags = principals_check_box_tags(name, principals)
+ principals.each_with_index do |principal, i|
+ assert_not_include avatar_tags[i], tags
+ assert_include content_tag('span', nil, :class => "name icon icon-#{principal.class.name.downcase}"), tags
+ end
+ end
+ end
+
def test_principals_options_for_select_with_users
User.current = nil
users = [User.find(2), User.find(4)]