Skip to content

Commit

Permalink
Add a test case for boolean input with include_hidden: false and sing…
Browse files Browse the repository at this point in the history
…le wrapper.
  • Loading branch information
nashby committed Feb 20, 2022
1 parent 515db9a commit 21148b3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/inputs/boolean_input_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 21148b3

Please sign in to comment.