input without additional classes should add "checkbox" class to label

closes #809
This commit is contained in:
Vasiliy Ermolovich 2013-05-28 23:12:18 +03:00
parent 9b2018052e
commit fbaddffd89
3 changed files with 15 additions and 0 deletions

View File

@ -5,6 +5,8 @@
* `input_field` supports `html5` component [@nashby](https://github.com/nashby)
### 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)
## 3.0.0.rc

View File

@ -17,6 +17,7 @@ module SimpleForm
input
elsif nested_boolean_style?
html_options = label_html_options.dup
html_options[:class] ||= []
html_options[:class].push(:checkbox)
build_hidden_field_for_checkbox +

View File

@ -137,4 +137,16 @@ class BooleanInputTest < ActionView::TestCase
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