Add an option to render Integer and Float custom fields with thousands delimiters (#39997).

Patch by Go MAEDA (user:maeda).


git-svn-id: https://svn.redmine.org/redmine/trunk@22935 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2024-07-18 04:56:20 +00:00
parent b374db2fdb
commit ee31bf8fe9
6 changed files with 30 additions and 5 deletions

View File

@@ -60,4 +60,15 @@ class Redmine::NumericFieldFormatTest < ActionView::TestCase
end
end
end
def test_integer_field_should_format_with_thousands_delimiter
field = IssueCustomField.generate!(field_format: 'int', thousands_delimiter: '1')
custom_value = CustomValue.new(custom_field: field, customized: Issue.find(1), value: '1234567')
to_test = {'en' => '1,234,567', 'de' => '1.234.567', 'fr' => '1 234 567'}
to_test.each do |locale, expected|
with_locale locale do
assert_equal expected, format_object(custom_value, html: false), locale
end
end
end
end