Introduce a setting to change the display format of timespans to h:mm (#23996).

Patch by Jens Kraemer.

git-svn-id: http://svn.redmine.org/redmine/trunk@15965 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2016-11-18 12:42:20 +00:00
parent 9c3e3a4276
commit 5495e6f342
15 changed files with 59 additions and 13 deletions

View File

@@ -1544,4 +1544,24 @@ RAW
stubs(:request).returns(stub(:env => {'HTTP_REFERER' => "/path?utf8=\u2713&foo=bar"}))
assert_equal "/path?foo=bar", back_url
end
def test_hours_formatting
set_language_if_valid 'en'
with_settings :timespan_format => 'minutes' do
assert_equal '0:45', format_hours(0.75)
assert_equal '0:45 h', l_hours_short(0.75)
assert_equal '0:45 hour', l_hours(0.75)
end
with_settings :timespan_format => 'decimal' do
assert_equal '0.75', format_hours(0.75)
assert_equal '0.75 h', l_hours_short(0.75)
assert_equal '0.75 hour', l_hours(0.75)
end
end
def test_html_hours
assert_equal '<span class="hours hours-int">0</span><span class="hours hours-dec">:45</span>', html_hours('0:45')
assert_equal '<span class="hours hours-int">0</span><span class="hours hours-dec">.75</span>', html_hours('0.75')
end
end