mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fixed that FormHelper#checkbox should return a checked checkbox if the value is the same as checked_value #1286 [Florian Weber]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1317 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
47dcc5ffc6
commit
496ee0cd1b
3 changed files with 12 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Fixed that FormHelper#checkbox should return a checked checkbox if the value is the same as checked_value #1286 [Florian Weber]
|
||||
|
||||
* Fixed Form.disable in Prototype #1317 [Wintermute]
|
||||
|
||||
* Added accessors to logger, params, response, session, and headers from the view, so you can write <% logger.info "stuff" %> instead of <% @logger.info "others" %> -- more consistent with the preferred way of accessing these attributes and collections from the controller
|
||||
|
|
|
@ -200,6 +200,8 @@ module ActionView
|
|||
false
|
||||
when Integer
|
||||
value != 0
|
||||
when String
|
||||
value == checked_value
|
||||
else
|
||||
value.to_i != 0
|
||||
end
|
||||
|
|
|
@ -81,6 +81,14 @@ class FormHelperTest < Test::Unit::TestCase
|
|||
)
|
||||
end
|
||||
|
||||
def test_check_box_with_explicit_checked_and_unchecked_values
|
||||
@post.secret = "on"
|
||||
assert_equal(
|
||||
'<input checked="checked" id="post_secret" name="post[secret]" type="checkbox" value="on" /><input name="post[secret]" type="hidden" value="off" />',
|
||||
check_box("post", "secret", {}, "on", "off")
|
||||
)
|
||||
end
|
||||
|
||||
def test_radio_button
|
||||
assert_equal('<input checked="checked" id="post_title_hello_world" name="post[title]" type="radio" value="Hello World" />',
|
||||
radio_button("post", "title", "Hello World")
|
||||
|
|
Loading…
Reference in a new issue