2011-09-11 17:52:20 -04:00
|
|
|
require 'test_helper'
|
|
|
|
|
|
|
|
class DisabledTest < ActionView::TestCase
|
2012-09-06 16:09:58 -04:00
|
|
|
test 'string input should be disabled when disabled option is true' do
|
2013-01-28 16:02:59 -05:00
|
|
|
with_input_for @user, :name, :string, disabled: true
|
2011-09-11 17:52:20 -04:00
|
|
|
assert_select 'input.string.disabled[disabled]'
|
2012-09-06 16:09:58 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
test 'text input should be disabled when disabled option is true' do
|
2013-01-28 16:02:59 -05:00
|
|
|
with_input_for @user, :description, :text, disabled: true
|
2011-09-11 17:52:20 -04:00
|
|
|
assert_select 'textarea.text.disabled[disabled]'
|
2012-09-06 16:09:58 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
test 'numeric input should be disabled when disabled option is true' do
|
2013-01-28 16:02:59 -05:00
|
|
|
with_input_for @user, :age, :integer, disabled: true
|
2011-09-11 17:52:20 -04:00
|
|
|
assert_select 'input.integer.disabled[disabled]'
|
2012-09-06 16:09:58 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
test 'date input should be disabled when disabled option is true' do
|
2013-01-28 16:02:59 -05:00
|
|
|
with_input_for @user, :born_at, :date, disabled: true
|
2011-09-11 17:52:20 -04:00
|
|
|
assert_select 'select.date.disabled[disabled]'
|
2012-09-06 16:09:58 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
test 'datetime input should be disabled when disabled option is true' do
|
2013-01-28 16:02:59 -05:00
|
|
|
with_input_for @user, :created_at, :datetime, disabled: true
|
2011-09-11 17:52:20 -04:00
|
|
|
assert_select 'select.datetime.disabled[disabled]'
|
2012-09-06 16:09:58 -04:00
|
|
|
end
|
2011-09-11 17:52:20 -04:00
|
|
|
|
2012-09-06 16:09:58 -04:00
|
|
|
test 'string input should not be disabled when disabled option is false' do
|
2013-01-28 16:02:59 -05:00
|
|
|
with_input_for @user, :name, :string, disabled: false
|
2012-09-06 16:09:58 -04:00
|
|
|
assert_no_select 'input.string.disabled[disabled]'
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'text input should not be disabled when disabled option is false' do
|
2013-01-28 16:02:59 -05:00
|
|
|
with_input_for @user, :description, :text, disabled: false
|
2012-09-06 16:09:58 -04:00
|
|
|
assert_no_select 'textarea.text.disabled[disabled]'
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'numeric input should not be disabled when disabled option is false' do
|
2013-01-28 16:02:59 -05:00
|
|
|
with_input_for @user, :age, :integer, disabled: false
|
2012-09-06 16:09:58 -04:00
|
|
|
assert_no_select 'input.integer.disabled[disabled]'
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'date input should not be disabled when disabled option is false' do
|
2013-01-28 16:02:59 -05:00
|
|
|
with_input_for @user, :born_at, :date, disabled: false
|
2012-09-06 16:09:58 -04:00
|
|
|
assert_no_select 'select.date.disabled[disabled]'
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'datetime input should not be disabled when disabled option is false' do
|
2013-01-28 16:02:59 -05:00
|
|
|
with_input_for @user, :created_at, :datetime, disabled: false
|
2012-09-06 16:09:58 -04:00
|
|
|
assert_no_select 'select.datetime.disabled[disabled]'
|
|
|
|
end
|
2011-09-11 17:52:20 -04:00
|
|
|
|
2012-09-06 16:09:58 -04:00
|
|
|
test 'string input should not be disabled when disabled option is not present' do
|
2011-09-11 17:52:20 -04:00
|
|
|
with_input_for @user, :name, :string
|
2012-09-06 16:09:58 -04:00
|
|
|
assert_no_select 'input.string.disabled[disabled]'
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'text input should not be disabled when disabled option is not present' do
|
2011-09-11 17:52:20 -04:00
|
|
|
with_input_for @user, :description, :text
|
2012-09-06 16:09:58 -04:00
|
|
|
assert_no_select 'textarea.text.disabled[disabled]'
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'numeric input should not be disabled when disabled option is not present' do
|
2011-09-11 17:52:20 -04:00
|
|
|
with_input_for @user, :age, :integer
|
2012-09-06 16:09:58 -04:00
|
|
|
assert_no_select 'input.integer.disabled[disabled]'
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'date input should not be disabled when disabled option is not present' do
|
2011-09-11 17:52:20 -04:00
|
|
|
with_input_for @user, :born_at, :date
|
2012-09-06 16:09:58 -04:00
|
|
|
assert_no_select 'select.date.disabled[disabled]'
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'datetime input should not be disabled when disabled option is not present' do
|
2011-09-11 17:52:20 -04:00
|
|
|
with_input_for @user, :created_at, :datetime
|
2012-09-06 16:09:58 -04:00
|
|
|
assert_no_select 'select.datetime.disabled[disabled]'
|
2011-09-11 17:52:20 -04:00
|
|
|
end
|
|
|
|
end
|