Assert `input` tags instead of `select` for datetime attributes.
This commit is contained in:
parent
fb1f52dbc5
commit
2b1dcd16ba
|
@ -158,22 +158,22 @@ class FormBuilderTest < ActionView::TestCase
|
||||||
|
|
||||||
test 'builder should generate date select for date columns' do
|
test 'builder should generate date select for date columns' do
|
||||||
with_form_for @user, :born_at
|
with_form_for @user, :born_at
|
||||||
assert_select 'form select#user_born_at_1i.date'
|
assert_select 'form input#user_born_at.date'
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'builder should generate time select for time columns' do
|
test 'builder should generate time select for time columns' do
|
||||||
with_form_for @user, :delivery_time
|
with_form_for @user, :delivery_time
|
||||||
assert_select 'form select#user_delivery_time_4i.time'
|
assert_select 'form input#user_delivery_time.time'
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'builder should generate datetime select for datetime columns' do
|
test 'builder should generate datetime select for datetime columns' do
|
||||||
with_form_for @user, :created_at
|
with_form_for @user, :created_at
|
||||||
assert_select 'form select#user_created_at_1i.datetime'
|
assert_select 'form input#user_created_at.datetime'
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'builder should generate datetime select for timestamp columns' do
|
test 'builder should generate datetime select for timestamp columns' do
|
||||||
with_form_for @user, :updated_at
|
with_form_for @user, :updated_at
|
||||||
assert_select 'form select#user_updated_at_1i.datetime'
|
assert_select 'form input#user_updated_at.datetime'
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'builder should generate file for file columns' do
|
test 'builder should generate file for file columns' do
|
||||||
|
@ -406,7 +406,7 @@ class FormBuilderTest < ActionView::TestCase
|
||||||
|
|
||||||
test 'builder should allow overriding input type when object is not present' do
|
test 'builder should allow overriding input type when object is not present' do
|
||||||
with_form_for :project, :created_at, as: :datetime
|
with_form_for :project, :created_at, as: :datetime
|
||||||
assert_select 'form select.datetime#project_created_at_1i'
|
assert_select 'form input.datetime#project_created_at'
|
||||||
with_form_for :project, :budget, as: :decimal
|
with_form_for :project, :budget, as: :decimal
|
||||||
assert_select 'form input.decimal#project_budget'
|
assert_select 'form input.decimal#project_budget'
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,12 +18,12 @@ class DisabledTest < ActionView::TestCase
|
||||||
|
|
||||||
test 'date input should be disabled when disabled option is true' do
|
test 'date input should be disabled when disabled option is true' do
|
||||||
with_input_for @user, :born_at, :date, disabled: true
|
with_input_for @user, :born_at, :date, disabled: true
|
||||||
assert_select 'select.date.disabled[disabled]'
|
assert_select 'input.date.disabled[disabled]'
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'datetime input should be disabled when disabled option is true' do
|
test 'datetime input should be disabled when disabled option is true' do
|
||||||
with_input_for @user, :created_at, :datetime, disabled: true
|
with_input_for @user, :created_at, :datetime, disabled: true
|
||||||
assert_select 'select.datetime.disabled[disabled]'
|
assert_select 'input.datetime.disabled[disabled]'
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'string input should not be disabled when disabled option is false' do
|
test 'string input should not be disabled when disabled option is false' do
|
||||||
|
|
|
@ -10,9 +10,9 @@ class InputTest < ActionView::TestCase
|
||||||
with_input_for @user, :age, :integer
|
with_input_for @user, :age, :integer
|
||||||
assert_select 'input.integer'
|
assert_select 'input.integer'
|
||||||
with_input_for @user, :born_at, :date
|
with_input_for @user, :born_at, :date
|
||||||
assert_select 'select.date'
|
assert_select 'input.date'
|
||||||
with_input_for @user, :created_at, :datetime
|
with_input_for @user, :created_at, :datetime
|
||||||
assert_select 'select.datetime'
|
assert_select 'input.datetime'
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'string input should generate autofocus attribute when autofocus option is true' do
|
test 'string input should generate autofocus attribute when autofocus option is true' do
|
||||||
|
@ -48,12 +48,12 @@ class InputTest < ActionView::TestCase
|
||||||
|
|
||||||
test 'date input should generate autofocus attribute when autofocus option is true' do
|
test 'date input should generate autofocus attribute when autofocus option is true' do
|
||||||
with_input_for @user, :born_at, :date, autofocus: true
|
with_input_for @user, :born_at, :date, autofocus: true
|
||||||
assert_select 'select.date[autofocus]'
|
assert_select 'input.date[autofocus]'
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'datetime input should generate autofocus attribute when autofocus option is true' do
|
test 'datetime input should generate autofocus attribute when autofocus option is true' do
|
||||||
with_input_for @user, :created_at, :datetime, autofocus: true
|
with_input_for @user, :created_at, :datetime, autofocus: true
|
||||||
assert_select 'select.datetime[autofocus]'
|
assert_select 'input.datetime[autofocus]'
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'string input should generate autofocus attribute when autofocus option is false' do
|
test 'string input should generate autofocus attribute when autofocus option is false' do
|
||||||
|
|
|
@ -18,12 +18,12 @@ class ReadonlyTest < ActionView::TestCase
|
||||||
|
|
||||||
test 'date input should generate readonly elements when readonly option is true' do
|
test 'date input should generate readonly elements when readonly option is true' do
|
||||||
with_input_for @user, :born_at, :date, readonly: true
|
with_input_for @user, :born_at, :date, readonly: true
|
||||||
assert_select 'select.date.readonly[readonly]'
|
assert_select 'input.date.readonly[readonly]'
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'datetime input should generate readonly elements when readonly option is true' do
|
test 'datetime input should generate readonly elements when readonly option is true' do
|
||||||
with_input_for @user, :created_at, :datetime, readonly: true
|
with_input_for @user, :created_at, :datetime, readonly: true
|
||||||
assert_select 'select.datetime.readonly[readonly]'
|
assert_select 'input.datetime.readonly[readonly]'
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'string input should generate readonly elements when readonly option is false' do
|
test 'string input should generate readonly elements when readonly option is false' do
|
||||||
|
|
Loading…
Reference in New Issue