Add "Author / Previous assignee" group to assignee dropdown in issue form (#16045).

Patch by Luka Lüdicke (user:dkd-luedicke), Mizuki ISHIKAWA (user:ishikawa999), and Go MAEDA (user:maeda).


git-svn-id: https://svn.redmine.org/redmine/trunk@23059 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2024-09-15 06:31:30 +00:00
parent 0078387dbc
commit 94d9a2337b
6 changed files with 71 additions and 8 deletions

View File

@@ -2052,10 +2052,16 @@ class ApplicationHelperTest < Redmine::HelperTest
User.current = nil
set_language_if_valid 'en'
users = [User.find(2), Group.find(11), User.find(4), Group.find(10)]
assert_equal(
%(<option value="2">John Smith</option><option value="4">Robert Hill</option>) +
%(<optgroup label="Groups"><option value="10">A Team</option><option value="11">B Team</option></optgroup>),
principals_options_for_select(users))
result = principals_options_for_select(users)
assert_select_in result, 'optgroup[label="Users"]' do
assert_select 'option[value="2"]', text: 'John Smith'
assert_select 'option[value="4"]', text: 'Robert Hill'
end
assert_select_in result, 'optgroup[label="Groups"]' do
assert_select 'option[value="10"]', text: 'A Team'
assert_select 'option[value="11"]', text: 'B Team'
end
end
def test_principals_options_for_select_with_empty_collection
@@ -2070,6 +2076,21 @@ class ApplicationHelperTest < Redmine::HelperTest
principals_options_for_select(users)
end
def test_principals_options_for_select_should_include_author_and_previous_assignee
set_language_if_valid 'en'
users = [User.find(2), User.find(3), User.find(1)]
@issue = Issue.generate!(author_id: 1, assigned_to_id: 2)
@issue.init_journal(users.first, 'update')
@issue.assigned_to_id = 3
@issue.save
result = principals_options_for_select(users)
assert_select_in result, 'optgroup[label="Author / Previous assignee"]' do
assert_select 'option:nth-of-type(1)', text: 'Redmine Admin' # Author
assert_select 'option:nth-of-type(2)', text: 'John Smith' # Prior assignee
end
end
def test_stylesheet_link_tag_should_pick_the_default_stylesheet
assert_match 'href="/assets/styles.css"', stylesheet_link_tag("styles")
end