Merge pull request #810 from plataformatec/issue-809
input without additional classes should not add "checkbox" class to label
This commit is contained in:
commit
dcf4862972
|
@ -5,6 +5,8 @@
|
||||||
* `input_field` supports `html5` component [@nashby](https://github.com/nashby)
|
* `input_field` supports `html5` component [@nashby](https://github.com/nashby)
|
||||||
|
|
||||||
### bug fix
|
### bug fix
|
||||||
|
* Add "checkbox" class to the label of boolean input when there is no `:label`
|
||||||
|
in `generate_additional_classes_for` config option [@nashby](https://github.com/nashby)
|
||||||
* Support models with digits in their names [@webgago](https://github.com/webgago)
|
* Support models with digits in their names [@webgago](https://github.com/webgago)
|
||||||
|
|
||||||
## 3.0.0.rc
|
## 3.0.0.rc
|
||||||
|
|
|
@ -17,6 +17,7 @@ module SimpleForm
|
||||||
input
|
input
|
||||||
elsif nested_boolean_style?
|
elsif nested_boolean_style?
|
||||||
html_options = label_html_options.dup
|
html_options = label_html_options.dup
|
||||||
|
html_options[:class] ||= []
|
||||||
html_options[:class].push(:checkbox)
|
html_options[:class].push(:checkbox)
|
||||||
|
|
||||||
build_hidden_field_for_checkbox +
|
build_hidden_field_for_checkbox +
|
||||||
|
|
|
@ -137,4 +137,16 @@ class BooleanInputTest < ActionView::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test 'input boolean without additional classes should add "checkbox" class to label' do
|
||||||
|
swap_wrapper :default, self.custom_wrapper_without_top_level do
|
||||||
|
swap SimpleForm, boolean_style: :nested, generate_additional_classes_for: [:input] do
|
||||||
|
with_input_for @user, :active, :boolean
|
||||||
|
|
||||||
|
assert_select 'label'
|
||||||
|
assert_select 'label.checkbox'
|
||||||
|
assert_no_select 'label.boolean'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue