mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fixed that FormHelper#radio_button didn't respect an :id being passed in (closes #6266) [evansj]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5247 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
8ff92e2435
commit
211ffd3f79
3 changed files with 10 additions and 2 deletions
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Fixed that FormHelper#radio_button didn't respect an :id being passed in #6266 [evansj]
|
||||
|
||||
* Added an html_options hash parameter to javascript_tag() and update_page_tag() helpers #6311 [tzaharia]. Example:
|
||||
|
||||
update_page_tag :defer => 'true' { |page| ... }
|
||||
|
|
|
@ -269,9 +269,9 @@ module ActionView
|
|||
else
|
||||
checked = self.class.radio_button_checked?(value(object), tag_value)
|
||||
end
|
||||
options["checked"] = "checked" if checked
|
||||
options["checked"] = "checked" if checked
|
||||
pretty_tag_value = tag_value.to_s.gsub(/\s/, "_").gsub(/\W/, "").downcase
|
||||
options["id"] = defined?(@auto_index) ?
|
||||
options["id"] ||= defined?(@auto_index) ?
|
||||
"#{@object_name}_#{@auto_index}_#{@method_name}_#{pretty_tag_value}" :
|
||||
"#{@object_name}_#{@method_name}_#{pretty_tag_value}"
|
||||
add_default_name_and_id(options)
|
||||
|
|
|
@ -120,6 +120,12 @@ class FormHelperTest < Test::Unit::TestCase
|
|||
radio_button("post", "secret", "1")
|
||||
)
|
||||
end
|
||||
|
||||
def test_radio_button_respects_passed_in_id
|
||||
assert_dom_equal('<input checked="checked" id="foo" name="post[secret]" type="radio" value="1" />',
|
||||
radio_button("post", "secret", "1", :id=>"foo")
|
||||
)
|
||||
end
|
||||
|
||||
def test_text_area
|
||||
assert_dom_equal(
|
||||
|
|
Loading…
Reference in a new issue