]> source.dussan.org Git - redmine.git/commitdiff
Adds tests for custom field description.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 14 Dec 2013 11:26:47 +0000 (11:26 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 14 Dec 2013 11:26:47 +0000 (11:26 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@12406 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/helpers/custom_fields_helper_test.rb

index 6fd6f94f5d19209f3de8ec3f8ed7b2b860ee5801..43ffc43ab902d21a6f936c37acb144fd70c415cf 100644 (file)
@@ -29,6 +29,18 @@ class CustomFieldsHelperTest < ActionView::TestCase
     assert_equal 'No', format_value('0', CustomField.new(:field_format => 'bool'))
   end
 
+  def test_label_tag_should_include_description_as_span_title_if_present
+    field = CustomField.new(:field_format => 'string', :description => 'This is the description')
+    tag = custom_field_label_tag('foo', CustomValue.new(:custom_field => field))
+    assert_select_in tag, 'label span[title=?]', 'This is the description'
+  end
+
+  def test_label_tag_should_not_include_title_if_description_is_blank
+    field = CustomField.new(:field_format => 'string')
+    tag = custom_field_label_tag('foo', CustomValue.new(:custom_field => field))
+    assert_select_in tag, 'label span[title]', 0
+  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)