diff options
author | Go MAEDA <maeda@farend.jp> | 2018-10-29 04:03:52 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2018-10-29 04:03:52 +0000 |
commit | 21034c5628d980bd18c6ef3f3ef898969745c390 (patch) | |
tree | 5ee7f27921cb24cfa7faa25da16523761e445a01 /test | |
parent | a99c7104c16796894dd6485c63a3e5e8b821e5e5 (diff) | |
download | redmine-21034c5628d980bd18c6ef3f3ef898969745c390.tar.gz redmine-21034c5628d980bd18c6ef3f3ef898969745c390.zip |
Filter issues after project status (#20081).
Patch by Marius BALTEANU.
git-svn-id: http://svn.redmine.org/redmine/trunk@17607 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/issues_controller_test.rb | 19 | ||||
-rw-r--r-- | test/helpers/queries_helper_test.rb | 2 | ||||
-rw-r--r-- | test/unit/query_test.rb | 23 |
3 files changed, 43 insertions, 1 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 17af8981c..62d96bd10 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -264,6 +264,25 @@ class IssuesControllerTest < Redmine::ControllerTest assert_equal [3, 5], issues_in_list.map(&:project_id).uniq.sort end + def test_index_with_project_status_filter + project = Project.find(2) + project.close + project.save + + get :index, :params => { + :set_filter => 1, + :f => ['project.status'], + :op => {'project.status' => '='}, + :v => {'project.status' => ['1']} + } + + assert_response :success + + issues = issues_in_list.map(&:id).uniq.sort + assert_include 1, issues + assert_not_include 4, issues + end + def test_index_with_query get :index, :params => { :project_id => 1, diff --git a/test/helpers/queries_helper_test.rb b/test/helpers/queries_helper_test.rb index 402d67ab8..8cce2625b 100644 --- a/test/helpers/queries_helper_test.rb +++ b/test/helpers/queries_helper_test.rb @@ -75,7 +75,7 @@ class QueriesHelperTest < Redmine::HelperTest with_locale 'en' do options = filters_options_for_select(IssueQuery.new) assert_select_in options, 'optgroup[label=?]', 'Project', 1 - assert_select_in options, 'optgroup[label=?] > option', 'Project', 2 + assert_select_in options, 'optgroup[label=?] > option', 'Project', 3 assert_select_in options, 'optgroup > option[value=?]', "project.cf_#{cf1.id}", :text => "Project's Foo" end end diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb index 8c530caeb..1a66bc4db 100644 --- a/test/unit/query_test.rb +++ b/test/unit/query_test.rb @@ -2199,4 +2199,27 @@ class QueryTest < ActiveSupport::TestCase assert_equal ['1','2','3','4','5','6'], query.available_filters['status_id'][:values].map(&:second) end + + def test_project_status_filter_should_be_available_in_global_queries + query = IssueQuery.new(:project => nil, :name => '_') + assert query.available_filters.has_key?('project.status') + end + + def test_project_status_filter_should_be_available_when_project_has_subprojects + query = IssueQuery.new(:project => Project.find(1), :name => '_') + assert query.available_filters.has_key?('project.status') + end + + def test_project_status_filter_should_not_be_available_when_project_is_leaf + query = IssueQuery.new(:project => Project.find(2), :name => '_') + assert !query.available_filters.has_key?('project.status') + end + + def test_project_statuses_values_should_return_only_active_and_closed_statuses + query = IssueQuery.new(:project => nil, :name => '_') + project_status_filter = query.available_filters['project.status'] + assert_not_nil project_status_filter + + assert_equal [["active", "1"], ["closed", "5"]], project_status_filter[:values] + end end |