simple_form 3.1.0.rc1 → 3.1.0.rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of simple_form might be problematic. Click here for more details.

Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -1
  3. data/README.md +37 -6
  4. data/lib/generators/simple_form/templates/config/initializers/simple_form.rb +6 -2
  5. data/lib/generators/simple_form/templates/config/initializers/simple_form_bootstrap.rb +37 -14
  6. data/lib/simple_form.rb +8 -0
  7. data/lib/simple_form/components/labels.rb +1 -1
  8. data/lib/simple_form/form_builder.rb +29 -15
  9. data/lib/simple_form/inputs/boolean_input.rb +7 -4
  10. data/lib/simple_form/tags.rb +1 -0
  11. data/lib/simple_form/version.rb +1 -1
  12. data/lib/simple_form/wrappers/builder.rb +2 -2
  13. data/lib/simple_form/wrappers/many.rb +1 -0
  14. data/test/action_view_extensions/builder_test.rb +3 -3
  15. data/test/action_view_extensions/form_helper_test.rb +13 -13
  16. data/test/components/label_test.rb +35 -35
  17. data/test/form_builder/association_test.rb +4 -4
  18. data/test/form_builder/button_test.rb +5 -5
  19. data/test/form_builder/error_test.rb +18 -18
  20. data/test/form_builder/general_test.rb +65 -60
  21. data/test/form_builder/hint_test.rb +15 -15
  22. data/test/form_builder/input_field_test.rb +16 -16
  23. data/test/form_builder/label_test.rb +22 -13
  24. data/test/form_builder/wrapper_test.rb +54 -20
  25. data/test/inputs/boolean_input_test.rb +8 -8
  26. data/test/inputs/collection_check_boxes_input_test.rb +24 -7
  27. data/test/inputs/collection_radio_buttons_input_test.rb +40 -23
  28. data/test/inputs/collection_select_input_test.rb +45 -45
  29. data/test/inputs/datetime_input_test.rb +23 -23
  30. data/test/inputs/disabled_test.rb +15 -15
  31. data/test/inputs/discovery_test.rb +44 -5
  32. data/test/inputs/file_input_test.rb +2 -2
  33. data/test/inputs/general_test.rb +20 -20
  34. data/test/inputs/grouped_collection_select_input_test.rb +2 -2
  35. data/test/inputs/hidden_input_test.rb +4 -4
  36. data/test/inputs/numeric_input_test.rb +24 -24
  37. data/test/inputs/priority_input_test.rb +7 -7
  38. data/test/inputs/readonly_test.rb +19 -19
  39. data/test/inputs/required_test.rb +13 -13
  40. data/test/inputs/string_input_test.rb +23 -23
  41. data/test/inputs/text_input_test.rb +4 -4
  42. data/test/support/discovery_inputs.rb +20 -0
  43. data/test/support/misc_helpers.rb +22 -0
  44. data/test/support/models.rb +2 -1
  45. metadata +2 -2
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
 
3
3
  # Tests for f.input_field
4
4
  class InputFieldTest < ActionView::TestCase
5
- test "builder input_field should only render the input tag, nothing else" do
5
+ test "builder input_field only renders the input tag, nothing else" do
6
6
  with_concat_form_for(@user) do |f|
7
7
  f.input_field :name
8
8
  end
@@ -12,7 +12,7 @@ class InputFieldTest < ActionView::TestCase
12
12
  assert_no_select '.hint'
13
13
  end
14
14
 
15
- test 'builder input_field should allow overriding default input type' do
15
+ test 'builder input_field allows overriding default input type' do
16
16
  with_concat_form_for(@user) do |f|
17
17
  f.input_field :name, as: :text
18
18
  end
@@ -21,7 +21,7 @@ class InputFieldTest < ActionView::TestCase
21
21
  assert_select 'textarea#user_name.text'
22
22
  end
23
23
 
24
- test 'builder input_field should generate input type based on column type' do
24
+ test 'builder input_field generates input type based on column type' do
25
25
  with_concat_form_for(@user) do |f|
26
26
  f.input_field :age
27
27
  end
@@ -29,7 +29,7 @@ class InputFieldTest < ActionView::TestCase
29
29
  assert_select 'input[type=number].integer#user_age'
30
30
  end
31
31
 
32
- test 'builder input_field should be able to disable any component' do
32
+ test 'builder input_field is able to disable any component' do
33
33
  with_concat_form_for(@user) do |f|
34
34
  f.input_field :age, html5: false
35
35
  end
@@ -38,7 +38,7 @@ class InputFieldTest < ActionView::TestCase
38
38
  assert_select 'input[type=text].integer#user_age'
39
39
  end
40
40
 
41
- test 'builder input_field should allow passing options to input tag' do
41
+ test 'builder input_field allows passing options to input tag' do
42
42
  with_concat_form_for(@user) do |f|
43
43
  f.input_field :name, id: 'name_input', class: 'name'
44
44
  end
@@ -46,7 +46,7 @@ class InputFieldTest < ActionView::TestCase
46
46
  assert_select 'input.string.name#name_input'
47
47
  end
48
48
 
49
- test 'builder input_field should not modify the options hash' do
49
+ test 'builder input_field does not modify the options hash' do
50
50
  options = { id: 'name_input', class: 'name' }
51
51
 
52
52
  with_concat_form_for(@user) do |f|
@@ -58,7 +58,7 @@ class InputFieldTest < ActionView::TestCase
58
58
  end
59
59
 
60
60
 
61
- test 'builder input_field should generate an input tag with a clean HTML' do
61
+ test 'builder input_field generates an input tag with a clean HTML' do
62
62
  with_concat_form_for(@user) do |f|
63
63
  f.input_field :name, as: :integer, class: 'name'
64
64
  end
@@ -67,7 +67,7 @@ class InputFieldTest < ActionView::TestCase
67
67
  assert_no_select 'input.integer[as]'
68
68
  end
69
69
 
70
- test 'builder input_field should use i18n to translate placeholder text' do
70
+ test 'builder input_field uses i18n to translate placeholder text' do
71
71
  store_translations(:en, simple_form: { placeholders: { user: {
72
72
  name: 'Name goes here'
73
73
  } } }) do
@@ -80,7 +80,7 @@ class InputFieldTest < ActionView::TestCase
80
80
  end
81
81
  end
82
82
 
83
- test 'builder input_field should use min_max component' do
83
+ test 'builder input_field uses min_max component' do
84
84
  with_concat_form_for(@other_validating_user) do |f|
85
85
  f.input_field :age, as: :integer
86
86
  end
@@ -88,7 +88,7 @@ class InputFieldTest < ActionView::TestCase
88
88
  assert_select 'input[min=18]'
89
89
  end
90
90
 
91
- test 'builder input_field should not use pattern component by default' do
91
+ test 'builder input_field does not use pattern component by default' do
92
92
  with_concat_form_for(@other_validating_user) do |f|
93
93
  f.input_field :country, as: :string
94
94
  end
@@ -96,7 +96,7 @@ class InputFieldTest < ActionView::TestCase
96
96
  assert_no_select 'input[pattern="\w+"]'
97
97
  end
98
98
 
99
- test 'builder input_field should infer pattern from attributes' do
99
+ test 'builder input_field infers pattern from attributes' do
100
100
  with_concat_form_for(@other_validating_user) do |f|
101
101
  f.input_field :country, as: :string, pattern: true
102
102
  end
@@ -104,7 +104,7 @@ class InputFieldTest < ActionView::TestCase
104
104
  assert_select 'input[pattern="\w+"]'
105
105
  end
106
106
 
107
- test 'builder input_field should accept custom patter' do
107
+ test 'builder input_field accepts custom patter' do
108
108
  with_concat_form_for(@other_validating_user) do |f|
109
109
  f.input_field :country, as: :string, pattern: '\d+'
110
110
  end
@@ -112,7 +112,7 @@ class InputFieldTest < ActionView::TestCase
112
112
  assert_select 'input[pattern="\d+"]'
113
113
  end
114
114
 
115
- test 'builder input_field should use readonly component' do
115
+ test 'builder input_field uses readonly component' do
116
116
  with_concat_form_for(@other_validating_user) do |f|
117
117
  f.input_field :age, as: :integer, readonly: true
118
118
  end
@@ -120,7 +120,7 @@ class InputFieldTest < ActionView::TestCase
120
120
  assert_select 'input.integer.readonly[readonly]'
121
121
  end
122
122
 
123
- test 'builder input_field should use maxlength component' do
123
+ test 'builder input_field uses maxlength component' do
124
124
  with_concat_form_for(@validating_user) do |f|
125
125
  f.input_field :name, as: :string
126
126
  end
@@ -128,7 +128,7 @@ class InputFieldTest < ActionView::TestCase
128
128
  assert_select 'input.string[maxlength=25]'
129
129
  end
130
130
 
131
- test 'builder collection input_field should generate input tag with a clean HTML' do
131
+ test 'builder collection input_field generates input tag with a clean HTML' do
132
132
  with_concat_form_for(@user) do |f|
133
133
  f.input_field :status, collection: ['Open', 'Closed'], class: 'status', label_method: :to_s, value_method: :to_s
134
134
  end
@@ -139,7 +139,7 @@ class InputFieldTest < ActionView::TestCase
139
139
  assert_no_select 'select.status[value_method]'
140
140
  end
141
141
 
142
- test 'build input_field does not treat "boolean_style" as an HTML attribute' do
142
+ test 'build input_field does not treat "boolean_style" as a HTML attribute' do
143
143
  with_concat_form_for(@user) do |f|
144
144
  f.input_field :active, boolean_style: :nested
145
145
  end
@@ -8,63 +8,63 @@ class LabelTest < ActionView::TestCase
8
8
  end
9
9
  end
10
10
 
11
- test 'builder should generate a label for the attribute' do
11
+ test 'builder generates a label for the attribute' do
12
12
  with_label_for @user, :name
13
13
  assert_select 'label.string[for=user_name]', /Name/
14
14
  end
15
15
 
16
- test 'builder should generate a label for the boolean attrbiute' do
16
+ test 'builder generates a label for the boolean attrbiute' do
17
17
  with_label_for @user, :name, as: :boolean
18
18
  assert_select 'label.boolean[for=user_name]', /Name/
19
19
  assert_no_select 'label[as=boolean]'
20
20
  end
21
21
 
22
- test 'builder should generate a label component tag with a clean HTML' do
22
+ test 'builder generates a label component tag with a clean HTML' do
23
23
  with_label_for @user, :name
24
24
  assert_no_select 'label.string[label_html]'
25
25
  end
26
26
 
27
- test 'builder should add a required class to label if the attribute is required' do
27
+ test 'builder adds a required class to label if the attribute is required' do
28
28
  with_label_for @validating_user, :name
29
29
  assert_select 'label.string.required[for=validating_user_name]', /Name/
30
30
  end
31
31
 
32
- test 'builder should escape label text' do
32
+ test 'builder escapes label text' do
33
33
  with_label_for @user, :name, label: '<script>alert(1337)</script>', required: false
34
34
  assert_select 'label.string', "&lt;script&gt;alert(1337)&lt;/script&gt;"
35
35
  end
36
36
 
37
- test 'builder should not escape label text if it is safe' do
37
+ test 'builder does not escape label text if it is safe' do
38
38
  with_label_for @user, :name, label: '<script>alert(1337)</script>'.html_safe, required: false
39
39
  assert_select 'label.string script', "alert(1337)"
40
40
  end
41
41
 
42
- test 'builder should allow passing options to label tag' do
42
+ test 'builder allows passing options to label tag' do
43
43
  with_label_for @user, :name, label: 'My label', id: 'name_label'
44
44
  assert_select 'label.string#name_label', /My label/
45
45
  end
46
46
 
47
- test 'builder label should generate label tag with clean HTML' do
47
+ test 'builder label generates label tag with clean HTML' do
48
48
  with_label_for @user, :name, label: 'My label', required: true, id: 'name_label'
49
49
  assert_select 'label.string#name_label', /My label/
50
50
  assert_no_select 'label[label]'
51
51
  assert_no_select 'label[required]'
52
52
  end
53
53
 
54
- test 'builder should not modify the options hash' do
54
+ test 'builder does not modify the options hash' do
55
55
  options = { label: 'My label', id: 'name_label' }
56
56
  with_label_for @user, :name, options
57
57
  assert_select 'label.string#name_label', /My label/
58
58
  assert_equal({ label: 'My label', id: 'name_label' }, options)
59
59
  end
60
60
 
61
- test 'builder should fallback to default label when string is given' do
61
+ test 'builder fallbacks to default label when string is given' do
62
62
  with_label_for @user, :name, 'Nome do usuário'
63
63
  assert_select 'label', 'Nome do usuário'
64
64
  assert_no_select 'label.string'
65
65
  end
66
66
 
67
- test 'builder should fallback to default label when block is given' do
67
+ test 'builder fallbacks to default label when block is given' do
68
68
  with_label_for @user, :name do
69
69
  'Nome do usuário'
70
70
  end
@@ -88,14 +88,23 @@ class LabelTest < ActionView::TestCase
88
88
  end
89
89
  end
90
90
 
91
- test 'builder should allow custom formatting when label is explicitly specified' do
91
+ test 'configuration allow set rewrited label tag for wrappers' do
92
+ swap_wrapper :default, self.custom_wrapper_with_custom_label_component do
93
+ with_concat_form_for(@user) do |f|
94
+ concat f.input :age
95
+ end
96
+ assert_select "span.integer.user_age", /Age/
97
+ end
98
+ end
99
+
100
+ test 'builder allows custom formatting when label is explicitly specified' do
92
101
  swap SimpleForm, label_text: lambda { |l, r, explicit_label| explicit_label ? l : "#{l.titleize}:" } do
93
102
  with_label_for @user, :time_zone, 'What is your home time zone?'
94
103
  assert_select 'label[for=user_time_zone]', 'What is your home time zone?'
95
104
  end
96
105
  end
97
106
 
98
- test 'builder should allow custom formatting when label is generated' do
107
+ test 'builder allows custom formatting when label is generated' do
99
108
  swap SimpleForm, label_text: lambda { |l, r, explicit_label| explicit_label ? l : "#{l.titleize}:" } do
100
109
  with_label_for @user, :time_zone
101
110
  assert_select 'label[for=user_time_zone]', 'Time Zone:'
@@ -1,22 +1,22 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class WrapperTest < ActionView::TestCase
4
- test 'wrapper should not have error class for attribute without errors' do
4
+ test 'wrapper does not have error class for attribute without errors' do
5
5
  with_form_for @user, :active
6
6
  assert_no_select 'div.field_with_errors'
7
7
  end
8
8
 
9
- test 'wrapper should not have error class when object is not present' do
9
+ test 'wrapper does not have error class when object is not present' do
10
10
  with_form_for :project, :name
11
11
  assert_no_select 'div.field_with_errors'
12
12
  end
13
13
 
14
- test 'wrapper should add the attribute name class' do
14
+ test 'wrapper adds the attribute name class' do
15
15
  with_form_for @user, :name
16
16
  assert_select 'div.user_name'
17
17
  end
18
18
 
19
- test 'wrapper should add the attribute name class for nested forms' do
19
+ test 'wrapper adds the attribute name class for nested forms' do
20
20
  @user.company = Company.new(1, 'Empresa')
21
21
  with_concat_form_for @user do |f|
22
22
  concat(f.simple_fields_for(:company) do |company_form|
@@ -27,44 +27,44 @@ class WrapperTest < ActionView::TestCase
27
27
  assert_select 'div.user_company_name'
28
28
  end
29
29
 
30
- test 'wrapper should add the association name class' do
30
+ test 'wrapper adds the association name class' do
31
31
  with_form_for @user, :company
32
32
  assert_select 'div.user_company'
33
33
  end
34
34
 
35
- test 'wrapper should add error class for attribute with errors' do
35
+ test 'wrapper adds error class for attribute with errors' do
36
36
  with_form_for @user, :name
37
37
  assert_select 'div.field_with_errors'
38
38
  end
39
39
 
40
- test 'wrapper should add hint class for attribute with a hint' do
40
+ test 'wrapper adds hint class for attribute with a hint' do
41
41
  with_form_for @user, :name, hint: 'hint'
42
42
  assert_select 'div.field_with_hint'
43
43
  end
44
44
 
45
- test 'wrapper should not have disabled class by default' do
45
+ test 'wrapper does not have disabled class by default' do
46
46
  with_form_for @user, :active
47
47
  assert_no_select 'div.disabled'
48
48
  end
49
49
 
50
- test 'wrapper should have disabled class when input is disabled' do
50
+ test 'wrapper has disabled class when input is disabled' do
51
51
  with_form_for @user, :active, disabled: true
52
52
  assert_select 'div.disabled'
53
53
  end
54
54
 
55
- test 'wrapper should support no wrapping when wrapper is false' do
55
+ test 'wrapper supports no wrapping when wrapper is false' do
56
56
  with_form_for @user, :name, wrapper: false
57
57
  assert_select 'form > label[for=user_name]'
58
58
  assert_select 'form > input#user_name.string'
59
59
  end
60
60
 
61
- test 'wrapper should support no wrapping when wrapper tag is false' do
61
+ test 'wrapper supports no wrapping when wrapper tag is false' do
62
62
  with_form_for @user, :name, wrapper: custom_wrapper_without_top_level
63
63
  assert_select 'form > label[for=user_name]'
64
64
  assert_select 'form > input#user_name.string'
65
65
  end
66
66
 
67
- test 'wrapper should wrapping tag adds required/optional css classes' do
67
+ test 'wrapper wraps tag adds required/optional css classes' do
68
68
  with_form_for @user, :name
69
69
  assert_select 'form div.input.required.string'
70
70
 
@@ -72,22 +72,22 @@ class WrapperTest < ActionView::TestCase
72
72
  assert_select 'form div.input.optional.integer'
73
73
  end
74
74
 
75
- test 'wrapper should allow custom options to be given' do
75
+ test 'wrapper allows custom options to be given' do
76
76
  with_form_for @user, :name, wrapper_html: { id: "super_cool", class: 'yay' }
77
77
  assert_select 'form #super_cool.required.string.yay'
78
78
  end
79
79
 
80
- test 'wrapper should allow tag to be given on demand' do
80
+ test 'wrapper allows tag to be given on demand' do
81
81
  with_form_for @user, :name, wrapper_tag: :b
82
82
  assert_select 'form b.required.string'
83
83
  end
84
84
 
85
- test 'wrapper should allow wrapper class to be given on demand' do
85
+ test 'wrapper allows wrapper class to be given on demand' do
86
86
  with_form_for @user, :name, wrapper_class: :wrapper
87
87
  assert_select 'form div.wrapper.required.string'
88
88
  end
89
89
 
90
- test 'wrapper should skip additional classes when configured' do
90
+ test 'wrapper skips additional classes when configured' do
91
91
  swap SimpleForm, generate_additional_classes_for: [:input, :label] do
92
92
  with_form_for @user, :name, wrapper_class: :wrapper
93
93
  assert_select 'form div.wrapper'
@@ -97,7 +97,7 @@ class WrapperTest < ActionView::TestCase
97
97
  end
98
98
  end
99
99
 
100
- test 'wrapper should not generate empty css class' do
100
+ test 'wrapper does not generate empty css class' do
101
101
  swap SimpleForm, generate_additional_classes_for: [:input, :label] do
102
102
  swap_wrapper :default, custom_wrapper_without_class do
103
103
  with_form_for @user, :name
@@ -187,7 +187,7 @@ class WrapperTest < ActionView::TestCase
187
187
  end
188
188
  end
189
189
 
190
- test 'do not duplicate label classes for different inputs' do
190
+ test 'does not duplicate label classes for different inputs' do
191
191
  swap_wrapper :default, self.custom_wrapper_with_label_html_option do
192
192
  with_concat_form_for(@user) do |f|
193
193
  concat f.input :name, required: false
@@ -206,7 +206,7 @@ class WrapperTest < ActionView::TestCase
206
206
  end
207
207
  end
208
208
 
209
- test 'use wrapper for specified in config mapping' do
209
+ test 'uses wrapper for specified in config mapping' do
210
210
  swap_wrapper :another do
211
211
  swap SimpleForm, wrapper_mappings: { string: :another } do
212
212
  with_form_for @user, :name
@@ -216,7 +216,7 @@ class WrapperTest < ActionView::TestCase
216
216
  end
217
217
  end
218
218
 
219
- test 'use custom wrapper mapping per form basis' do
219
+ test 'uses custom wrapper mapping per form basis' do
220
220
  swap_wrapper :another do
221
221
  with_concat_form_for @user, wrapper_mappings: { string: :another } do |f|
222
222
  concat f.input :name
@@ -267,4 +267,38 @@ class WrapperTest < ActionView::TestCase
267
267
 
268
268
  assert_select "div.custom_wrapper input.string[data-modal=true]"
269
269
  end
270
+
271
+ test 'inline wrapper displays when there is content' do
272
+ swap_wrapper :default, self.custom_wrapper_with_wrapped_optional_component do
273
+ with_form_for @user, :name, hint: "can't be blank"
274
+ assert_select 'section.custom_wrapper div.no_output_wrapper p.omg_hint', "can&#39;t be blank"
275
+ assert_select 'p.omg_hint'
276
+ end
277
+ end
278
+
279
+ test 'inline wrapper does not display when there is no content' do
280
+ swap_wrapper :default, self.custom_wrapper_with_wrapped_optional_component do
281
+ with_form_for @user, :name
282
+ assert_select 'section.custom_wrapper div.no_output_wrapper'
283
+ assert_no_select 'p.omg_hint'
284
+ end
285
+ end
286
+
287
+ test 'optional wrapper does not display when there is content' do
288
+ swap_wrapper :default, self.custom_wrapper_with_unless_blank do
289
+ with_form_for @user, :name, hint: "can't be blank"
290
+ assert_select 'section.custom_wrapper div.no_output_wrapper'
291
+ assert_select 'div.no_output_wrapper'
292
+ assert_select 'p.omg_hint'
293
+ end
294
+ end
295
+
296
+ test 'optional wrapper does not display when there is no content' do
297
+ swap_wrapper :default, self.custom_wrapper_with_unless_blank do
298
+ with_form_for @user, :name
299
+ assert_no_select 'section.custom_wrapper div.no_output_wrapper'
300
+ assert_no_select 'div.no_output_wrapper'
301
+ assert_no_select 'p.omg_hint'
302
+ end
303
+ end
270
304
  end
@@ -2,7 +2,7 @@
2
2
  require 'test_helper'
3
3
 
4
4
  class BooleanInputTest < ActionView::TestCase
5
- test 'input should generate a checkbox by default for boolean attributes' do
5
+ test 'input generates a checkbox by default for boolean attributes' do
6
6
  with_input_for @user, :active, :boolean
7
7
  assert_select 'input[type=checkbox].boolean#user_active'
8
8
  assert_select 'label.boolean.optional', 'Active'
@@ -49,42 +49,42 @@ class BooleanInputTest < ActionView::TestCase
49
49
 
50
50
  test 'input boolean with nested allows :inline_label' do
51
51
  swap SimpleForm, boolean_style: :nested do
52
- with_input_for @user, :active, :boolean, label: false, inline_label: 'I am so inline.'
52
+ with_input_for @user, :active, :boolean, inline_label: 'I am so inline.'
53
53
  assert_select 'label.checkbox', text: ' I am so inline.'
54
54
  end
55
55
  end
56
56
 
57
57
  test 'input boolean with nested escapes :inline_label with HTML' do
58
58
  swap SimpleForm, boolean_style: :nested do
59
- with_input_for @user, :active, :boolean, label: false, inline_label: '<b>I am so inline.</b>'
59
+ with_input_for @user, :active, :boolean, inline_label: '<b>I am so inline.</b>'
60
60
  assert_select 'label.checkbox', text: ' &lt;b&gt;I am so inline.&lt;/b&gt;'
61
61
  end
62
62
  end
63
63
 
64
64
  test 'input boolean with nested allows :inline_label with HTML when safe' do
65
65
  swap SimpleForm, boolean_style: :nested do
66
- with_input_for @user, :active, :boolean, label: false, inline_label: '<b>I am so inline.</b>'.html_safe
66
+ with_input_for @user, :active, :boolean, inline_label: '<b>I am so inline.</b>'.html_safe
67
67
  assert_select 'label.checkbox b', text: 'I am so inline.'
68
68
  end
69
69
  end
70
70
 
71
71
  test 'input boolean with nested style creates an inline label using the default label text when inline_label option set to true' do
72
72
  swap SimpleForm, boolean_style: :nested do
73
- with_input_for @user, :active, :boolean, label: false, inline_label: true
73
+ with_input_for @user, :active, :boolean, inline_label: true
74
74
  assert_select 'label.checkbox', text: ' Active'
75
75
  end
76
76
  end
77
77
 
78
78
  test 'input boolean with nested style creates an inline label using the label text when inline_label option set to true' do
79
79
  swap SimpleForm, boolean_style: :nested do
80
- with_input_for @user, :active, :boolean, label: false, inline_label: true, label_text: proc { 'New Active' }
80
+ with_input_for @user, :active, :boolean, inline_label: true, label_text: proc { 'New Active' }
81
81
  assert_select 'label.checkbox', text: ' New Active'
82
82
  end
83
83
  end
84
84
 
85
85
  test 'input boolean with nested style creates an inline label using the label html when inline_label option set to true' do
86
86
  swap SimpleForm, boolean_style: :nested do
87
- with_input_for @user, :active, :boolean, label: false, inline_label: true, label_text: proc { '<b>New Active</b>' }
87
+ with_input_for @user, :active, :boolean, inline_label: true, label_text: proc { '<b>New Active</b>' }
88
88
  assert_select 'label.checkbox', text: ' New Active'
89
89
  end
90
90
  end
@@ -186,7 +186,7 @@ class BooleanInputTest < ActionView::TestCase
186
186
  end
187
187
  end
188
188
 
189
- test 'input boolean without additional classes should add "checkbox" class to label' do
189
+ test 'input boolean without additional classes adds "checkbox" class to label' do
190
190
  swap_wrapper :default, self.custom_wrapper_without_top_level do
191
191
  swap SimpleForm, boolean_style: :nested, generate_additional_classes_for: [:input] do
192
192
  with_input_for @user, :active, :boolean