From 446f70f584320aa8da62b72a7116dce298eca07e Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 4 Oct 2015 19:42:37 +0000 Subject: Adds options to display totals on the issue list (#1561). Works for estimated hours, spent hours and any numeric custom field. git-svn-id: http://svn.redmine.org/redmine/trunk@14642 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/functional/issues_controller_test.rb | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'test/functional') diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 432693a56..18c82aef1 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -945,6 +945,38 @@ class IssuesControllerTest < ActionController::TestCase assert_select 'td.parent a[title=?]', parent.subject end + def test_index_with_estimated_hours_total + Issue.delete_all + Issue.generate!(:estimated_hours => 5.5) + Issue.generate!(:estimated_hours => 1.1) + + get :index, :t => %w(estimated_hours) + assert_response :success + assert_select '.query-totals' + assert_select '.total-for-estimated-hours span.value', :text => '6.6' + assert_select 'input[type=checkbox][name=?][value=estimated_hours][checked=checked]', 't[]' + end + + def test_index_with_int_custom_field_total + field = IssueCustomField.generate!(:field_format => 'int', :is_for_all => true) + CustomValue.create!(:customized => Issue.find(1), :custom_field => field, :value => '2') + CustomValue.create!(:customized => Issue.find(2), :custom_field => field, :value => '7') + + get :index, :t => ["cf_#{field.id}"] + assert_response :success + assert_select '.query-totals' + assert_select ".total-for-cf-#{field.id} span.value", :text => '9' + end + + def test_index_totals_should_default_to_settings + with_settings :issue_list_default_totals => ['estimated_hours'] do + get :index + assert_response :success + assert_select '.total-for-estimated-hours span.value' + assert_select '.query-totals>span', 1 + end + end + def test_index_send_html_if_query_is_invalid get :index, :f => ['start_date'], :op => {:start_date => '='} assert_equal 'text/html', @response.content_type -- cgit v1.2.3