Permalink
Browse files

Fixed that FormTagHelper#text_area_tag should disregard :size option …

…if it's not a string [Brendon Davidson]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6300 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
dhh committed Mar 3, 2007
1 parent b2c0359 commit 1dc56ba4815a5d87df34ade0125512a6101d3b87
View
@@ -1,5 +1,7 @@
*SVN*
+* Fixed that FormTagHelper#text_area_tag should disregard :size option if it's not a string [Brendon Davidson]
+
* Set the original button value in an attribute of the button when using the :disable_with key with submit_tag, so that the original can be restored later. [Jamis Buck]
* session_enabled? works with session :off. #6680 [Catfish]
@@ -302,7 +302,7 @@ def to_text_area_tag(options = {})
add_default_name_and_id(options)
if size = options.delete("size")
- options["cols"], options["rows"] = size.split("x")
+ options["cols"], options["rows"] = size.split("x") if size.respond_to?(:split)
end
content_tag("textarea", html_escape(options.delete('value') || value_before_type_cast(object)), options)
@@ -114,7 +114,7 @@ def text_area_tag(name, content = nil, options = {})
options.stringify_keys!
if size = options.delete("size")
- options["cols"], options["rows"] = size.split("x")
+ options["cols"], options["rows"] = size.split("x") if size.respond_to?(:split)
end
content_tag :textarea, content, { "name" => name, "id" => name }.update(options.stringify_keys)
@@ -105,6 +105,12 @@ def test_text_area_tag_size_symbol
assert_dom_equal expected, actual
end
+ def test_text_area_tag_should_disregard_size_if_its_given_as_an_integer
+ actual = text_area_tag "body", "hello world", :size => 20
+ expected = %(<textarea id="body" name="body">hello world</textarea>)
+ assert_dom_equal expected, actual
+ end
+
def test_text_field_tag
actual = text_field_tag "title", "Hello!"
expected = %(<input id="title" name="title" type="text" value="Hello!" />)

0 comments on commit 1dc56ba

Please sign in to comment.