Skip to content

Commit

Permalink
Default step of "any" for number input
Browse files Browse the repository at this point in the history
  • Loading branch information
Fede Soria authored and carlosantoniodasilva committed Mar 16, 2011
1 parent 3c07619 commit 5aa4320
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class NumericInput < Base
def input
input_html_options[:type] ||= "number"
input_html_options[:size] ||= SimpleForm.default_input_size
input_html_options[:step] ||= 1 if integer?
input_html_options[:step] ||= integer? ? 1 : "any"
infer_attributes_from_validations!
@builder.text_field(attribute_name, input_html_options)
end
Expand Down
4 changes: 2 additions & 2 deletions test/inputs_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@ def with_input_for(object, attribute_name, type, options={})
assert_select 'input[max=119]'
end

test 'input should infer step value only from integer attribute' do
test 'input should have step value of any except for integer attribute' do
with_input_for @validating_user, :age, :float
assert_no_select 'input[step]'
assert_select 'input[step="any"]'

with_input_for @validating_user, :age, :integer
assert_select 'input[step=1]'
Expand Down

0 comments on commit 5aa4320

Please sign in to comment.