summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-06-06 21:17:16 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-06-06 21:17:16 +0000
commit3bb7524c1f282827331a31db3731fc2459d05186 (patch)
tree481597fd97dbd82c931ec4ef6e0c0a3fad5860bf /test
parentba4744d4c48e21f3f640fca860993e36998e943d (diff)
downloadredmine-3bb7524c1f282827331a31db3731fc2459d05186.tar.gz
redmine-3bb7524c1f282827331a31db3731fc2459d05186.zip
Merged r16574 (#25760).
git-svn-id: http://svn.redmine.org/redmine/branches/3.2-stable@16621 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/helpers/custom_fields_helper_test.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/unit/helpers/custom_fields_helper_test.rb b/test/unit/helpers/custom_fields_helper_test.rb
index 5ee500f3e..c27137c20 100644
--- a/test/unit/helpers/custom_fields_helper_test.rb
+++ b/test/unit/helpers/custom_fields_helper_test.rb
@@ -41,6 +41,36 @@ class CustomFieldsHelperTest < ActionView::TestCase
assert_select_in tag, 'label span[title]', 0
end
+ def test_label_tag_should_include_for_attribute_for_select_tag
+ field = CustomField.new(:name => 'Foo', :field_format => 'list')
+ s = custom_field_tag_with_label('foo', CustomValue.new(:custom_field => field))
+ assert_select_in s, 'label[for]'
+ end
+
+ def test_label_tag_should_not_include_for_attribute_for_checkboxes
+ field = CustomField.new(:name => 'Foo', :field_format => 'list', :edit_tag_style => 'check_box')
+ s = custom_field_tag_with_label('foo', CustomValue.new(:custom_field => field))
+ assert_select_in s, 'label:not([for])'
+ end
+
+ def test_label_tag_should_include_for_attribute_for_bool_as_select_tag
+ field = CustomField.new(:name => 'Foo', :field_format => 'bool')
+ s = custom_field_tag_with_label('foo', CustomValue.new(:custom_field => field))
+ assert_select_in s, 'label[for]'
+ end
+
+ def test_label_tag_should_include_for_attribute_for_bool_as_checkbox
+ field = CustomField.new(:name => 'Foo', :field_format => 'bool', :edit_tag_style => 'check_box')
+ s = custom_field_tag_with_label('foo', CustomValue.new(:custom_field => field))
+ assert_select_in s, 'label[for]'
+ end
+
+ def test_label_tag_should_not_include_for_attribute_for_bool_as_radio
+ field = CustomField.new(:name => 'Foo', :field_format => 'bool', :edit_tag_style => 'radio')
+ s = custom_field_tag_with_label('foo', CustomValue.new(:custom_field => field))
+ assert_select_in s, 'label:not([for])'
+ end
+
def test_unknow_field_format_should_be_edited_as_string
field = CustomField.new(:field_format => 'foo')
value = CustomValue.new(:value => 'bar', :custom_field => field)