diff options
author | Go MAEDA <maeda@farend.jp> | 2023-05-05 03:50:51 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2023-05-05 03:50:51 +0000 |
commit | 8d320b864c7d8584ae76fa05b34422bdbc59400a (patch) | |
tree | 3f0af6b684dfe4b7e488d20d4d58a5a0afdff8db /test | |
parent | 53ec1c0e43c8b33fbe923805893ac1021c9f4766 (diff) | |
download | redmine-8d320b864c7d8584ae76fa05b34422bdbc59400a.tar.gz redmine-8d320b864c7d8584ae76fa05b34422bdbc59400a.zip |
Add test for r22224 (#38458).
git-svn-id: https://svn.redmine.org/redmine/trunk@22225 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/helpers/watchers_helper_test.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/helpers/watchers_helper_test.rb b/test/helpers/watchers_helper_test.rb index 88aac77de..1fe0de556 100644 --- a/test/helpers/watchers_helper_test.rb +++ b/test/helpers/watchers_helper_test.rb @@ -21,6 +21,8 @@ require_relative '../test_helper' class WatchersHelperTest < Redmine::HelperTest include WatchersHelper + include AvatarsHelper + include ERB::Util include Rails.application.routes.url_helpers fixtures :users, :issues @@ -66,4 +68,31 @@ class WatchersHelperTest < Redmine::HelperTest ) assert_equal expected, watcher_link(Issue.find(1), User.find(1)) end + + def test_watchers_list_should_be_sorted_by_user_name + issue = Issue.find(1) + [1, 2, 3].shuffle.each do |user_id| + Watcher.create!(:watchable => issue, :user => User.find(user_id)) + end + + with_settings user_format: 'firstname_lastname' do + result1 = watchers_list(issue) + assert_select_in result1, 'ul.watchers' do + assert_select 'li', 3 + assert_select 'li:nth-of-type(1)>a[href=?]', '/users/3', text: 'Dave Lopper' + assert_select 'li:nth-of-type(2)>a[href=?]', '/users/2', text: 'John Smith' + assert_select 'li:nth-of-type(3)>a[href=?]', '/users/1', text: 'Redmine Admin' + end + end + + with_settings user_format: 'lastname_firstname' do + result2 = watchers_list(issue) + assert_select_in result2, 'ul.watchers' do + assert_select 'li', 3 + assert_select 'li:nth-of-type(1)>a[href=?]', '/users/1', text: 'Admin Redmine' + assert_select 'li:nth-of-type(2)>a[href=?]', '/users/3', text: 'Lopper Dave' + assert_select 'li:nth-of-type(3)>a[href=?]', '/users/2', text: 'Smith John' + end + end + end end |