Add a test case for boolean input with include_hidden: false and single wrapper.

This commit is contained in:
Vasiliy Ermolovich 2022-02-20 20:24:04 +03:00
parent 515db9acb3
commit 1b3e91036a
1 changed files with 8 additions and 0 deletions

View File

@ -154,6 +154,14 @@ class BooleanInputTest < ActionView::TestCase
end
end
test 'input with nested style and with single wrapper allows disabling hidden field' do
swap SimpleForm, boolean_style: :nested do
with_input_for @user, :active, :boolean, include_hidden: false, wrapper: custom_wrapper_with_wrapped_label_input
assert_select "label.boolean > input.boolean"
assert_no_select "input[type=hidden] + label.boolean"
end
end
test 'input with nested style does not include hidden field when unchecked_value is false' do
swap SimpleForm, boolean_style: :nested do
with_input_for @user, :active, :boolean, unchecked_value: false