1
0
Fork 0
mirror of https://github.com/heartcombo/simple_form.git synced 2022-11-09 12:19:26 -05:00
heartcombo--simple_form/test/inputs/disabled_test.rb
2011-09-11 18:53:00 -03:00

38 lines
1.8 KiB
Ruby

require 'test_helper'
class DisabledTest < ActionView::TestCase
test 'input should generate disabled elements based on the disabled option' do
with_input_for @user, :name, :string, :disabled => true
assert_select 'input.string.disabled[disabled]'
with_input_for @user, :description, :text, :disabled => true
assert_select 'textarea.text.disabled[disabled]'
with_input_for @user, :age, :integer, :disabled => true
assert_select 'input.integer.disabled[disabled]'
with_input_for @user, :born_at, :date, :disabled => true
assert_select 'select.date.disabled[disabled]'
with_input_for @user, :created_at, :datetime, :disabled => true
assert_select 'select.datetime.disabled[disabled]'
with_input_for @user, :name, :string, :disabled => false
assert_select 'input.string:not(.disabled[disabled])'
with_input_for @user, :description, :text, :disabled => false
assert_select 'textarea.text:not(.disabled[disabled])'
with_input_for @user, :age, :integer, :disabled => false
assert_select 'input.integer:not(.disabled[disabled])'
with_input_for @user, :born_at, :date, :disabled => false
assert_select 'select.date:not(.disabled[disabled])'
with_input_for @user, :created_at, :datetime, :disabled => false
assert_select 'select.datetime:not(.disabled[disabled])'
with_input_for @user, :name, :string
assert_select 'input.string:not(.disabled[disabled])'
with_input_for @user, :description, :text
assert_select 'textarea.text:not(.disabled[disabled])'
with_input_for @user, :age, :integer
assert_select 'input.integer:not(.disabled[disabled])'
with_input_for @user, :born_at, :date
assert_select 'select.date:not(.disabled[disabled])'
with_input_for @user, :created_at, :datetime
assert_select 'select.datetime:not(.disabled[disabled])'
end
end