Mercurial > hg > soundsoftware-site
diff test/unit/helpers/custom_fields_helper_test.rb @ 1526:404aa68d4227
Merge from live branch
author | Chris Cannam |
---|---|
date | Thu, 11 Sep 2014 12:46:20 +0100 |
parents | dffacf8a6908 |
children |
line wrap: on
line diff
--- a/test/unit/helpers/custom_fields_helper_test.rb Mon Mar 17 08:57:04 2014 +0000 +++ b/test/unit/helpers/custom_fields_helper_test.rb Thu Sep 11 12:46:20 2014 +0100 @@ -1,5 +1,5 @@ # Redmine - project management software -# Copyright (C) 2006-2012 Jean-Philippe Lang +# Copyright (C) 2006-2014 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,14 +18,27 @@ require File.expand_path('../../../test_helper', __FILE__) class CustomFieldsHelperTest < ActionView::TestCase + include ApplicationHelper include CustomFieldsHelper include Redmine::I18n include ERB::Util def test_format_boolean_value I18n.locale = 'en' - assert_equal 'Yes', format_value('1', 'bool') - assert_equal 'No', format_value('0', 'bool') + assert_equal 'Yes', format_value('1', CustomField.new(:field_format => 'bool')) + 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 @@ -41,7 +54,7 @@ field = CustomField.new(:field_format => 'foo') field.id = 52 - assert_equal '<input class="foo_cf" id="object_custom_field_values_52" name="object[custom_field_values][52]" type="text" value="" />', + assert_include '<input class="foo_cf" id="object_custom_field_values_52" name="object[custom_field_values][52]" type="text" value="" />', custom_field_tag_for_bulk_edit('object', field) end end