Fix spec paths && render sub menu nodes only when not added to list of hidden menu nodes

pull/7444/head
Henriette Dinger 5 years ago
parent ed43b9ba04
commit 32a8592284
  1. 1
      app/controllers/settings_controller.rb
  2. 3
      lib/redmine/menu_manager/menu_helper.rb
  3. 6
      spec/features/auth/consent_auth_stage_spec.rb
  4. 4
      spec/features/menu_items/admin_menu_item_spec.rb
  5. 6
      spec/features/users/delete_spec.rb
  6. 5
      spec/features/users/password_change_spec.rb

@ -32,7 +32,6 @@ class SettingsController < ApplicationController
before_action :require_admin before_action :require_admin
current_menu_item [:index, :edit] do current_menu_item [:index, :edit] do
:settings :settings
end end

@ -61,6 +61,7 @@ module Redmine::MenuManager::MenuHelper
links = [] links = []
menu_items = first_level_menu_items_for(menu, project) do |node| menu_items = first_level_menu_items_for(menu, project) do |node|
@menu = menu
links << render_menu_node(node, project) links << render_menu_node(node, project)
end end
@ -145,7 +146,7 @@ module Redmine::MenuManager::MenuHelper
content_tag :li, html_options do content_tag :li, html_options do
# Standard children # Standard children
standard_children_list = node.children.map { |child| standard_children_list = node.children.map { |child|
render_menu_node(child, project) render_menu_node(child, project) if visible_node?(@menu, child)
}.join.html_safe }.join.html_safe
# Unattached children # Unattached children

@ -134,12 +134,10 @@ describe 'Authentication Stages', type: :feature, js: true do
expect_logged_in expect_logged_in
# Update consent date # Update consent date
visit settings_path(tab: 'users') visit users_settings_path
find("#toggle_consent_time").set(true) find("#toggle_consent_time").set(true)
within '#tab-content-users' do click_on 'Save'
click_on 'Save'
end
expect(page).to have_selector('.flash.notice') expect(page).to have_selector('.flash.notice')
Setting.clear_cache Setting.clear_cache

@ -45,7 +45,7 @@ feature 'Admin menu items' do
expect(page).to have_selector('a', text: I18n.t('label_user_plural')) expect(page).to have_selector('a', text: I18n.t('label_user_plural'))
expect(page).to have_selector('a', text: I18n.t('label_role_plural')) expect(page).to have_selector('a', text: I18n.t('label_role_plural'))
expect(page).to have_selector('a', text: I18n.t('label_work_package_types')) expect(page).to have_selector('a', text: I18n.t('label_type_plural'))
end end
end end
@ -60,7 +60,7 @@ feature 'Admin menu items' do
expect(page).to have_selector('a', text: I18n.t('label_user_plural')) expect(page).to have_selector('a', text: I18n.t('label_user_plural'))
expect(page).not_to have_selector('a', text: I18n.t('label_role_plural')) expect(page).not_to have_selector('a', text: I18n.t('label_role_plural'))
expect(page).not_to have_selector('a', text: I18n.t('label_work_package_types')) expect(page).not_to have_selector('a', text: I18n.t('label_type_plural'))
end end
end end
end end

@ -107,14 +107,12 @@ describe 'user deletion: ', type: :feature, js: true do
Setting.users_deletable_by_admins = 0 Setting.users_deletable_by_admins = 0
Setting.users_deletable_by_self = 0 Setting.users_deletable_by_self = 0
visit settings_path(tab: 'users') visit users_settings_path
find(:css, "#settings_users_deletable_by_admins").set(true) find(:css, "#settings_users_deletable_by_admins").set(true)
find(:css, "#settings_users_deletable_by_self").set(true) find(:css, "#settings_users_deletable_by_self").set(true)
within '#tab-content-users' do click_on 'Save'
click_on 'Save'
end
expect(Setting.users_deletable_by_admins?).to eq true expect(Setting.users_deletable_by_admins?).to eq true
expect(Setting.users_deletable_by_self?).to eq true expect(Setting.users_deletable_by_self?).to eq true

@ -118,12 +118,9 @@ describe 'random password generation',
end end
it 'can configure and enforce password rules', js: true do it 'can configure and enforce password rules', js: true do
visit '/settings' visit authentication_settings_path
expect_angular_frontend_initialized expect_angular_frontend_initialized
# Go to authentication
find('#tab-authentication').click
# Enforce rules # Enforce rules
# 3 of 'lowercase, uppercase, special' # 3 of 'lowercase, uppercase, special'
find('.form--check-box[value=uppercase]').set true find('.form--check-box[value=uppercase]').set true

Loading…
Cancel
Save