mirror of
https://github.com/heartcombo/simple_form.git
synced 2022-11-09 12:19:26 -05:00
Merge pull request #620 from carnesmedia/boolean_field_ignores_input_html
Boolean hidden field uses name when :nested
This commit is contained in:
commit
5548b2cb28
2 changed files with 9 additions and 1 deletions
|
@ -50,7 +50,8 @@ module SimpleForm
|
||||||
# generates invalid html - html5 only).
|
# generates invalid html - html5 only).
|
||||||
def build_hidden_field_for_checkbox
|
def build_hidden_field_for_checkbox
|
||||||
@builder.hidden_field(attribute_name, :value => '0', :id => nil,
|
@builder.hidden_field(attribute_name, :value => '0', :id => nil,
|
||||||
:disabled => input_html_options[:disabled])
|
:disabled => input_html_options[:disabled],
|
||||||
|
:name => input_html_options[:name])
|
||||||
end
|
end
|
||||||
|
|
||||||
def inline_label
|
def inline_label
|
||||||
|
|
|
@ -84,6 +84,13 @@ class BooleanInputTest < ActionView::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test 'input with nested style allows customizing input_html' do
|
||||||
|
swap SimpleForm, :boolean_style => :nested do
|
||||||
|
with_input_for @user, :active, :boolean, :input_html => { :name => 'active_user' }
|
||||||
|
assert_select "input[type=hidden][name=active_user] + label.boolean > input.boolean[name=active_user]"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
test 'input boolean works using :input only in wrapper config (no label_input)' do
|
test 'input boolean works using :input only in wrapper config (no label_input)' do
|
||||||
swap_wrapper do
|
swap_wrapper do
|
||||||
with_input_for @user, :active, :boolean
|
with_input_for @user, :active, :boolean
|
||||||
|
|
Loading…
Reference in a new issue