Don't interpret the :value option on text_area as an html attribute. Set the text_area's value. Closes #3752.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3550 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
a447e82de4
commit
ba2619f539
|
@ -1,5 +1,7 @@
|
||||||
*SVN*
|
*SVN*
|
||||||
|
|
||||||
|
* Don't interpret the :value option on text_area as an html attribute. Set the text_area's value. #3752 [gabriel@gironda.org]
|
||||||
|
|
||||||
* Fix remote_form_for creates a non-ajax form. [Rick Olson]
|
* Fix remote_form_for creates a non-ajax form. [Rick Olson]
|
||||||
|
|
||||||
* Don't let arbitrary classes match as controllers -- a potentially dangerous bug. [Nicholas Seckar]
|
* Don't let arbitrary classes match as controllers -- a potentially dangerous bug. [Nicholas Seckar]
|
||||||
|
|
|
@ -277,7 +277,7 @@ module ActionView
|
||||||
def to_text_area_tag(options = {})
|
def to_text_area_tag(options = {})
|
||||||
options = DEFAULT_TEXT_AREA_OPTIONS.merge(options.stringify_keys)
|
options = DEFAULT_TEXT_AREA_OPTIONS.merge(options.stringify_keys)
|
||||||
add_default_name_and_id(options)
|
add_default_name_and_id(options)
|
||||||
content_tag("textarea", html_escape(value_before_type_cast), options)
|
content_tag("textarea", html_escape(options.delete('value') || value_before_type_cast), options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_check_box_tag(options = {}, checked_value = "1", unchecked_value = "0")
|
def to_check_box_tag(options = {}, checked_value = "1", unchecked_value = "0")
|
||||||
|
|
|
@ -127,6 +127,13 @@ class FormHelperTest < Test::Unit::TestCase
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_text_area_with_alternate_value
|
||||||
|
assert_dom_equal(
|
||||||
|
'<textarea cols="40" id="post_body" name="post[body]" rows="20">Testing alternate values.</textarea>',
|
||||||
|
text_area("post", "body", :value => 'Testing alternate values.')
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
def test_date_selects
|
def test_date_selects
|
||||||
assert_dom_equal(
|
assert_dom_equal(
|
||||||
'<textarea cols="40" id="post_body" name="post[body]" rows="20">Back to the hill and over it again!</textarea>',
|
'<textarea cols="40" id="post_body" name="post[body]" rows="20">Back to the hill and over it again!</textarea>',
|
||||||
|
|
Loading…
Reference in New Issue