diff options
author | Go MAEDA <maeda@farend.jp> | 2025-03-27 01:07:48 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2025-03-27 01:07:48 +0000 |
commit | e0e0be492894d958a1fff6533465123889c6eff8 (patch) | |
tree | d8eeb97f3a0fca949ace8c3871a4838843b0f129 /test | |
parent | c866aa74d84c2aaf69e03c05903c1cd0da9ba67b (diff) | |
download | redmine-e0e0be492894d958a1fff6533465123889c6eff8.tar.gz redmine-e0e0be492894d958a1fff6533465123889c6eff8.zip |
"For all projects" checkbox should be disabled when editing an existing query in which the checkbox is already checked (#42458).
Patch by [Agileware] nusohiro (user:nusohiro).
git-svn-id: https://svn.redmine.org/redmine/trunk@23573 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/queries_controller_test.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/functional/queries_controller_test.rb b/test/functional/queries_controller_test.rb index 7f446f2b4..4f0827da8 100644 --- a/test/functional/queries_controller_test.rb +++ b/test/functional/queries_controller_test.rb @@ -1030,4 +1030,44 @@ class QueriesControllerTest < Redmine::ControllerTest assert_include ["Development", "10"], json assert_include ["Inactive Activity", "14"], json end + + def test_new_query_is_for_all_checkbox_not_disabled + @request.session[:user_id] = 1 + get :new + assert_response :success + # Verify that the "For all projects" checkbox is not disabled when creating a new query + assert_select 'input[name=query_is_for_all][type=checkbox][checked]:not([disabled])' + end + + def test_new_project_query_is_for_all_checkbox_not_disabled + @request.session[:user_id] = 1 + get(:new, :params => {:project_id => 1}) + assert_response :success + # Verify that the checkbox is not disabled when creating a new query within a project + assert_select 'input[name=query_is_for_all][type=checkbox]:not([checked]):not([disabled])' + end + + def test_edit_global_query_is_for_all_checkbox_disabled + @request.session[:user_id] = 1 + # Create a global query (project_id = nil) + query = IssueQuery.create!(:name => 'test_global_query', :user_id => 1, :project_id => nil) + + get(:edit, :params => {:id => query.id}) + assert_response :success + + # Verify that the "For all projects" checkbox is disabled when editing an existing global query + assert_select 'input[name=query_is_for_all][type=checkbox][checked][disabled]' + end + + def test_edit_project_query_is_for_all_checkbox_not_disabled + @request.session[:user_id] = 1 + # Create a project-specific query + query = IssueQuery.create!(:name => 'test_project_query', :user_id => 1, :project_id => 1) + + get(:edit, :params => {:id => query.id}) + assert_response :success + + # Verify that the checkbox is not disabled when editing a project-specific query + assert_select 'input[name=query_is_for_all][type=checkbox]:not([checked]):not([disabled])' + end end |