Merge pull request #1772 from yboulkaid/main
Honor `include_hidden` on inline boolean inputs
This commit is contained in:
commit
486ff139b6
|
@ -12,7 +12,11 @@ module SimpleForm
|
|||
inline_label
|
||||
}
|
||||
else
|
||||
build_check_box(unchecked_value, merged_input_options)
|
||||
if include_hidden?
|
||||
build_check_box(unchecked_value, merged_input_options)
|
||||
else
|
||||
build_check_box_without_hidden_field(merged_input_options)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -33,6 +33,11 @@ class BooleanInputTest < ActionView::TestCase
|
|||
assert_select 'input[type=hidden][value=off]'
|
||||
end
|
||||
|
||||
test 'input allows skipping hidden input when setting :include_hidden to false' do
|
||||
with_input_for @user, :active, :boolean, include_hidden: false
|
||||
assert_no_select "input[type=hidden][name='user[active]']"
|
||||
end
|
||||
|
||||
test 'input uses inline boolean style by default' do
|
||||
with_input_for @user, :active, :boolean
|
||||
assert_select 'input.boolean + label.boolean.optional'
|
||||
|
|
Loading…
Reference in New Issue