diff --git a/test/inputs_test.rb b/test/inputs_test.rb index e0fbbf54..d03a9b36 100644 --- a/test/inputs_test.rb +++ b/test/inputs_test.rb @@ -27,27 +27,12 @@ class InputTest < ActionView::TestCase assert_select 'select.datetime' end - # TextFieldInput + # StringInput test 'input should map text field to string attribute' do with_input_for @user, :name, :string assert_select 'input[name=\'user[name]\'][id=user_name][value=New in Simple Form!][type=text]' end - test 'input should generate an integer text field for integer attributes ' do - with_input_for @user, :age, :integer - assert_select 'input[type=number].integer#user_age' - end - - test 'input should generate a float text field for float attributes ' do - with_input_for @user, :age, :float - assert_select 'input[type=number].float#user_age' - end - - test 'input should generate a decimal text field for decimal attributes ' do - with_input_for @user, :age, :decimal - assert_select 'input[type=number].decimal#user_age' - end - test 'input should use default text size for decimal attributes' do with_input_for @user, :credit_limit, :decimal assert_select 'input.decimal[size=50]' @@ -63,6 +48,22 @@ class InputTest < ActionView::TestCase assert_select 'input.string[size=50]' end + # NumericInput + test 'input should generate an integer text field for integer attributes ' do + with_input_for @user, :age, :integer + assert_select 'input[type=number].integer#user_age' + end + + test 'input should generate a float text field for float attributes ' do + with_input_for @user, :age, :float + assert_select 'input[type=number].float#user_age' + end + + test 'input should generate a decimal text field for decimal attributes ' do + with_input_for @user, :age, :decimal + assert_select 'input[type=number].decimal#user_age' + end + # BooleanInput test 'input should generate a checkbox by default for boolean attributes' do with_input_for @user, :active, :boolean