Permalink
Browse files

Recognize :cols and :rows options as attributes for textarea inputs i…

…n the default formatter
  • Loading branch information...
1 parent d8093e4 commit 246e0910b0be0ed147c52e6f7b3f1979634e0b0e @jeremyevans committed May 1, 2012
Showing with 9 additions and 0 deletions.
  1. +2 −0 CHANGELOG
  2. +1 −0 lib/forme.rb
  3. +6 −0 spec/forme_spec.rb
View
@@ -1,5 +1,7 @@
=== HEAD
+* Recognize :cols and :rows options as attributes for textarea inputs in the default formatter (jeremyevans)
+
* Recognize :size and :maxlength options as attributes for text inputs in the default formatter (jeremyevans)
* Recognize :style option as attributes in the default formatter (jeremyevans)
View
@@ -796,6 +796,7 @@ def format_select
# Formats a textarea. Respects the following options:
# :value :: Sets value as the child of the textarea.
def format_textarea
+ copy_options_to_attributes([:cols, :rows])
if val = @attr.delete(:value)
tag(:textarea, @attr, [val])
else
View
@@ -98,6 +98,12 @@ def sel(opts, s)
specify "should create textarea tag" do
@f.input(:textarea).to_s.should == '<textarea></textarea>'
+ @f.input(:textarea, :value=>'a').to_s.should == '<textarea>a</textarea>'
+ end
+
+ specify "should use :cols and :rows options as attributes for textarea inputs" do
+ @f.input(:text, :cols=>5, :rows=>10).to_s.should == '<input type="text"/>'
+ @f.input(:textarea, :cols=>5, :rows=>10).to_s.should == '<textarea cols="5" rows="10"></textarea>'
end
specify "should create select tag" do

0 comments on commit 246e091

Please sign in to comment.