Skip to content

Commit

Permalink
Merge pull request #306 from jasonmp85/fix_numeric_input
Browse files Browse the repository at this point in the history
Numeric inputs incorrectly add a 'size' attribute
  • Loading branch information
rafaelfranca committed Aug 26, 2011
2 parents 5d4021f + 0332313 commit e16a901
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/simple_form/inputs/numeric_input.rb
Expand Up @@ -3,7 +3,7 @@ module Inputs
class NumericInput < Base
def input
input_html_options[:type] ||= "number" if SimpleForm.html5
input_html_options[:size] ||= SimpleForm.default_input_size
input_html_options[:size] ||= nil
input_html_options[:step] ||= integer? ? 1 : "any" if SimpleForm.html5
infer_attributes_from_validations! if SimpleForm.html5
@builder.text_field(attribute_name, input_html_options)
Expand Down
4 changes: 2 additions & 2 deletions test/inputs_test.rb
Expand Up @@ -141,9 +141,9 @@ def with_input_for(object, attribute_name, type, options={})
assert_select "input#user_password.password[type=password][name='user[password]']"
end

test 'input should use default text size for decimal attributes' do
test 'input should not use size attribute for decimal attributes' do
with_input_for @user, :credit_limit, :decimal
assert_select 'input.decimal[size=50]'
assert_no_select 'input.decimal[size]'
end

test 'input should get maxlength from column definition for string attributes' do
Expand Down

0 comments on commit e16a901

Please sign in to comment.