diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-06-29 04:00:19 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-06-29 04:00:19 -0700 |
commit | 7cf663707106a0320755770682898ed90439fa6a (patch) | |
tree | 607dc614669cd9e247e167592b2b4facb10fc3f0 /actionview/test | |
parent | 396f23234af89fcc92a9509ee3764a60d4f06210 (diff) | |
parent | 53eb9fdd9c546b101b22e1711ed0c3dd3df19197 (diff) | |
download | rails-7cf663707106a0320755770682898ed90439fa6a.tar.gz rails-7cf663707106a0320755770682898ed90439fa6a.tar.bz2 rails-7cf663707106a0320755770682898ed90439fa6a.zip |
Merge pull request #11156 from JonRowe/fix_tags_picking_string_keys_from_non_stringified_options
Fetch value(s) from stringified options in tags that stringify options
Diffstat (limited to 'actionview/test')
-rw-r--r-- | actionview/test/template/form_helper_test.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/actionview/test/template/form_helper_test.rb b/actionview/test/template/form_helper_test.rb index 1ff320224d..db44b00ef6 100644 --- a/actionview/test/template/form_helper_test.rb +++ b/actionview/test/template/form_helper_test.rb @@ -702,6 +702,11 @@ class FormHelperTest < ActionView::TestCase assert_dom_equal(expected, color_field("car", "color")) end + def test_color_field_with_value_attr + expected = %{<input id="car_color" name="car[color]" type="color" value="#00FF00" />} + assert_dom_equal(expected, color_field("car", "color", value: "#00FF00")) + end + def test_search_field expected = %{<input id="contact_notes_query" name="contact[notes_query]" type="search" />} assert_dom_equal(expected, search_field("contact", "notes_query")) @@ -732,6 +737,12 @@ class FormHelperTest < ActionView::TestCase assert_dom_equal(expected, date_field("post", "written_on", min: min_value, max: max_value, step: step)) end + def test_date_field_with_value_attr + expected = %{<input id="post_written_on" name="post[written_on]" type="date" value="2013-06-29" />} + value = Date.new(2013,6,29) + assert_dom_equal(expected, date_field("post", "written_on", value: value)) + end + def test_date_field_with_timewithzone_value previous_time_zone, Time.zone = Time.zone, 'UTC' expected = %{<input id="post_written_on" name="post[written_on]" type="date" value="2004-06-15" />} @@ -802,6 +813,12 @@ class FormHelperTest < ActionView::TestCase assert_dom_equal(expected, datetime_field("post", "written_on", min: min_value, max: max_value, step: step)) end + def test_datetime_field_with_value_attr + expected = %{<input id="post_written_on" name="post[written_on]" type="datetime" value="2013-06-29T13:37:00+00:00" />} + value = DateTime.new(2013,6,29,13,37) + assert_dom_equal(expected, datetime_field("post", "written_on", value: value)) + end + def test_datetime_field_with_timewithzone_value previous_time_zone, Time.zone = Time.zone, 'UTC' expected = %{<input id="post_written_on" name="post[written_on]" type="datetime" value="2004-06-15T15:30:45.000+0000" />} |