Fix bug that disable the entire select and wrapper when option is a string or array. Closes #301
This commit is contained in:
parent
aca5fe06bf
commit
d796f6a8d2
|
@ -11,6 +11,7 @@
|
|||
* bug fix
|
||||
* Fix bug when simple_fields_for is used with a hash like models and Rails 3.1
|
||||
* Fix bug that doesn't remove the item_wrapper_tag or the collection_wrapper_tag on collection inputs when nil or false value is passed to these options (by gitbub.com/dw2)
|
||||
* Fix bug that disable the entire select and wrapper when `disabled` option is a string or array
|
||||
|
||||
== 1.4.2
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ module SimpleForm
|
|||
end
|
||||
|
||||
def disabled?
|
||||
options[:disabled]
|
||||
options[:disabled] === true
|
||||
end
|
||||
|
||||
# Lookup translations for the given namespace using I18n, based on object name,
|
||||
|
|
|
@ -720,6 +720,22 @@ class InputTest < ActionView::TestCase
|
|||
assert_select 'select option[value=2]', 'Carlos'
|
||||
end
|
||||
|
||||
test 'input should disable the anothers components when the option is a object' do
|
||||
with_input_for @user, :description, :select, :collection => ["Jose", "Carlos"], :disabled => true
|
||||
assert_no_select 'select option[value=Jose][disabled=disabled]', 'Jose'
|
||||
assert_no_select 'select option[value=Carlos][disabled=disabled]', 'Carlos'
|
||||
assert_select 'select[disabled=disabled]'
|
||||
assert_select 'div.disabled'
|
||||
end
|
||||
|
||||
test 'input should not disable the anothers components when the option is a object' do
|
||||
with_input_for @user, :description, :select, :collection => ["Jose", "Carlos"], :disabled => 'Jose'
|
||||
assert_select 'select option[value=Jose][disabled=disabled]', 'Jose'
|
||||
assert_no_select 'select option[value=Carlos][disabled=disabled]', 'Carlos'
|
||||
assert_no_select 'select[disabled=disabled]'
|
||||
assert_no_select 'div.disabled'
|
||||
end
|
||||
|
||||
test 'input should allow overriding collection for radio types' do
|
||||
with_input_for @user, :name, :radio, :collection => ['Jose', 'Carlos']
|
||||
assert_select 'input[type=radio][value=Jose]'
|
||||
|
|
Loading…
Reference in New Issue