mirror of
https://github.com/redmine/redmine.git
synced 2025-11-02 03:15:57 +01:00
Adds a optgroup for groups in users/groups select tags.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6307 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -675,4 +675,27 @@ RAW
|
||||
assert_equal %(<a href="/projects/ecookbook/settings" class="project">eCookbook</a>),
|
||||
link_to_project(project, {:action => 'settings'}, :class => "project")
|
||||
end
|
||||
|
||||
def test_principals_options_for_select_with_users
|
||||
users = [User.find(2), User.find(4)]
|
||||
assert_equal %(<option value="2">John Smith</option><option value="4">Robert Hill</option>),
|
||||
principals_options_for_select(users)
|
||||
end
|
||||
|
||||
def test_principals_options_for_select_with_selected
|
||||
users = [User.find(2), User.find(4)]
|
||||
assert_equal %(<option value="2">John Smith</option><option value="4" selected="selected">Robert Hill</option>),
|
||||
principals_options_for_select(users, User.find(4))
|
||||
end
|
||||
|
||||
def test_principals_options_for_select_with_users_and_groups
|
||||
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)
|
||||
end
|
||||
|
||||
def test_principals_options_for_select_with_empty_collection
|
||||
assert_equal '', principals_options_for_select([])
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user