summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-10-04 19:42:37 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-10-04 19:42:37 +0000
commit446f70f584320aa8da62b72a7116dce298eca07e (patch)
tree046ec4a3108ccd6af6ec4d70594923610408a329 /test/functional
parent35a059a756144384888fcc576a72d20b2417e009 (diff)
downloadredmine-446f70f584320aa8da62b72a7116dce298eca07e.tar.gz
redmine-446f70f584320aa8da62b72a7116dce298eca07e.zip
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
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/issues_controller_test.rb32
1 files changed, 32 insertions, 0 deletions
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