mirror of
https://github.com/redmine/redmine.git
synced 2025-11-02 19:36:00 +01:00
Hide menu item in the cross-project menu if the module is not enabled in any project (#30207).
Patch by Yuichi HARADA. git-svn-id: http://svn.redmine.org/redmine/trunk@17794 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -84,4 +84,30 @@ class MenuManagerTest < Redmine::IntegrationTest
|
||||
get '/'
|
||||
assert_select 'body.has-main-menu', 0
|
||||
end
|
||||
|
||||
def test_cross_project_menu_should_hide_item_if_module_is_not_enabled_for_any_project
|
||||
user = User.find_by_login('dlopper')
|
||||
assert_equal [1, 3, 4, 6], Project.visible(user).ids
|
||||
|
||||
# gantt and news are not enabled for any visible project
|
||||
Project.find(1).enabled_module_names = %w(issue_tracking calendar)
|
||||
Project.find(3).enabled_module_names = %w(time_tracking)
|
||||
EnabledModule.where(:project_id => [4, 6]).delete_all
|
||||
|
||||
log_user('dlopper', 'foo')
|
||||
get '/projects'
|
||||
assert_select '#main-menu' do
|
||||
assert_select 'a.projects', :count => 1
|
||||
assert_select 'a.activity', :count => 1
|
||||
|
||||
assert_select 'a.issues', :count => 1 # issue_tracking
|
||||
assert_select 'a.time-entries', :count => 1 # time_tracking
|
||||
assert_select 'a.gantt', :count => 0 # gantt
|
||||
assert_select 'a.calendar', :count => 1 # calendar
|
||||
assert_select 'a.news', :count => 0 # news
|
||||
end
|
||||
assert_select '#projects-index' do
|
||||
assert_select 'a.project', :count => 4
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user