diff --git a/test/functional/context_menus_controller_test.rb b/test/functional/context_menus_controller_test.rb index 5309e7ba60..7d2b0cf43d 100644 --- a/test/functional/context_menus_controller_test.rb +++ b/test/functional/context_menus_controller_test.rb @@ -290,6 +290,32 @@ class ContextMenusControllerTest < Redmine::ControllerTest assert_select 'a', :text => 'eCookbook - Shared' end + def test_context_menu_should_include_add_subtask_link + @request.session[:user_id] = 2 + get( + :issues, + :params => { + :ids => [1] + } + ) + assert_response :success + + assert_select 'a.icon-add[href=?]', '/projects/ecookbook/issues/new?issue%5Bparent_issue_id%5D=1&issue%5Btracker_id%5D=1', :text => 'Add subtask' + end + + def test_context_menu_multiple_issues_should_not_include_add_subtask_link + @request.session[:user_id] = 2 + get( + :issues, + :params => { + :ids => [1, 2] + } + ) + assert_response :success + + assert_select 'a.icon-add[href=?]', '/projects/ecookbook/issues/new?issue%5Bparent_issue_id%5D=1&issue%5Btracker_id%5D=1', :text => 'Add subtask', :count => 0 + end + def test_context_menu_with_issue_that_is_not_visible_should_fail get( :issues, diff --git a/test/helpers/issues_helper_test.rb b/test/helpers/issues_helper_test.rb index 4fe6034543..fdd5f3598a 100644 --- a/test/helpers/issues_helper_test.rb +++ b/test/helpers/issues_helper_test.rb @@ -360,4 +360,11 @@ class IssuesHelperTest < Redmine::HelperTest assert_equal '06/06/2019', issue_due_date_details(issue) end end + + def test_url_for_new_subtask + issue = Issue.find(1) + params = {:issue => {:parent_issue_id => issue.id, :tracker_id => issue.tracker.id}} + assert_equal new_project_issue_path(issue.project, params), + url_for_new_subtask(issue) + end end