From ac8d3e3acabf3ece495f591a7195d794d6c611e1 Mon Sep 17 00:00:00 2001 From: Jeff Dean Date: Fri, 11 Jun 2010 20:25:58 -0400 Subject: make text_field and hidden_field omit the value attribute if the developer explicitly passes in :value => nil [#4839 state:resolved] Signed-off-by: Michael Koziarski --- actionpack/test/template/form_helper_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index 11a3283092..6ba407e230 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -188,6 +188,11 @@ class FormHelperTest < ActionView::TestCase assert_dom_equal expected, text_field("post", "title", :maxlength => 35, :size => nil) end + def test_text_field_with_nil_value + expected = '' + assert_dom_equal expected, text_field("post", "title", :value => nil) + end + def test_text_field_doesnt_change_param_values object_name = 'post[]' expected = '' @@ -208,6 +213,11 @@ class FormHelperTest < ActionView::TestCase hidden_field("post", "title") end + def test_hidden_field_with_nil_value + expected = '' + assert_dom_equal expected, hidden_field("post", "title", :value => nil) + end + def test_text_field_with_options assert_dom_equal '', hidden_field("post", "title", :value => "Something Else") -- cgit v1.2.3