simple_form 3.1.0.rc1 → 3.1.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -1
- data/README.md +64 -16
- data/lib/generators/simple_form/install_generator.rb +2 -2
- data/lib/generators/simple_form/templates/config/initializers/simple_form.rb +9 -4
- data/lib/generators/simple_form/templates/config/initializers/simple_form_bootstrap.rb +45 -15
- data/lib/generators/simple_form/templates/config/initializers/simple_form_foundation.rb +85 -4
- data/lib/simple_form/action_view_extensions/builder.rb +1 -0
- data/lib/simple_form/action_view_extensions/form_helper.rb +5 -1
- data/lib/simple_form/components/errors.rb +3 -5
- data/lib/simple_form/components/labels.rb +1 -1
- data/lib/simple_form/form_builder.rb +34 -19
- data/lib/simple_form/inputs/boolean_input.rb +8 -5
- data/lib/simple_form/inputs/collection_input.rb +2 -4
- data/lib/simple_form/tags.rb +3 -4
- data/lib/simple_form/version.rb +1 -1
- data/lib/simple_form/wrappers/builder.rb +2 -2
- data/lib/simple_form/wrappers/many.rb +1 -0
- data/lib/simple_form.rb +21 -2
- data/test/action_view_extensions/builder_test.rb +34 -34
- data/test/action_view_extensions/form_helper_test.rb +33 -14
- data/test/components/label_test.rb +36 -36
- data/test/form_builder/association_test.rb +41 -41
- data/test/form_builder/button_test.rb +10 -10
- data/test/form_builder/error_test.rb +88 -29
- data/test/form_builder/general_test.rb +89 -64
- data/test/form_builder/hint_test.rb +18 -18
- data/test/form_builder/input_field_test.rb +59 -19
- data/test/form_builder/label_test.rb +23 -14
- data/test/form_builder/wrapper_test.rb +70 -21
- data/test/generators/simple_form_generator_test.rb +2 -2
- data/test/inputs/boolean_input_test.rb +17 -9
- data/test/inputs/collection_check_boxes_input_test.rb +46 -7
- data/test/inputs/collection_radio_buttons_input_test.rb +65 -26
- data/test/inputs/collection_select_input_test.rb +62 -62
- data/test/inputs/datetime_input_test.rb +24 -24
- data/test/inputs/disabled_test.rb +15 -15
- data/test/inputs/discovery_test.rb +44 -5
- data/test/inputs/file_input_test.rb +2 -2
- data/test/inputs/general_test.rb +20 -20
- data/test/inputs/grouped_collection_select_input_test.rb +10 -10
- data/test/inputs/hidden_input_test.rb +4 -4
- data/test/inputs/numeric_input_test.rb +43 -43
- data/test/inputs/priority_input_test.rb +13 -13
- data/test/inputs/readonly_test.rb +19 -19
- data/test/inputs/required_test.rb +13 -13
- data/test/inputs/string_input_test.rb +33 -33
- data/test/inputs/text_input_test.rb +7 -7
- data/test/support/discovery_inputs.rb +20 -0
- data/test/support/misc_helpers.rb +28 -0
- data/test/support/models.rb +13 -2
- data/test/test_helper.rb +5 -1
- metadata +4 -4
|
@@ -6,30 +6,30 @@ class CollectionCheckBoxesInputTest < ActionView::TestCase
|
|
|
6
6
|
SimpleForm::Inputs::CollectionCheckBoxesInput.reset_i18n_cache :boolean_collection
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
test 'input check boxes
|
|
9
|
+
test 'input check boxes does not include for attribute by default' do
|
|
10
10
|
with_input_for @user, :gender, :check_boxes, collection: [:male, :female]
|
|
11
11
|
assert_select 'label'
|
|
12
12
|
assert_no_select 'label[for=user_gender]'
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
test 'input check boxes
|
|
15
|
+
test 'input check boxes includes for attribute when giving as html option' do
|
|
16
16
|
with_input_for @user, :gender, :check_boxes, collection: [:male, :female], label_html: { for: 'gender' }
|
|
17
17
|
assert_select 'label[for=gender]'
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
test 'collection input with check_boxes type
|
|
20
|
+
test 'collection input with check_boxes type does not generate required html attribute' do
|
|
21
21
|
with_input_for @user, :name, :check_boxes, collection: ['Jose', 'Carlos']
|
|
22
22
|
assert_select 'input.required'
|
|
23
23
|
assert_no_select 'input[required]'
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
test 'collection input with check_boxes type
|
|
26
|
+
test 'collection input with check_boxes type does not generate aria-required html attribute' do
|
|
27
27
|
with_input_for @user, :name, :check_boxes, collection: ['Jose', 'Carlos']
|
|
28
28
|
assert_select 'input.required'
|
|
29
29
|
assert_no_select 'input[aria-required]'
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
test 'input
|
|
32
|
+
test 'input does automatic collection translation for check_box types using defaults key' do
|
|
33
33
|
store_translations(:en, simple_form: { options: { defaults: {
|
|
34
34
|
gender: { male: 'Male', female: 'Female'}
|
|
35
35
|
} } } ) do
|
|
@@ -41,7 +41,7 @@ class CollectionCheckBoxesInputTest < ActionView::TestCase
|
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
test 'input
|
|
44
|
+
test 'input does automatic collection translation for check_box types using specific object key' do
|
|
45
45
|
store_translations(:en, simple_form: { options: { user: {
|
|
46
46
|
gender: { male: 'Male', female: 'Female'}
|
|
47
47
|
} } } ) do
|
|
@@ -53,7 +53,7 @@ class CollectionCheckBoxesInputTest < ActionView::TestCase
|
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
test 'input that uses automatic collection translation for check_boxes
|
|
56
|
+
test 'input that uses automatic collection translation for check_boxes properly sets checked values' do
|
|
57
57
|
store_translations(:en, simple_form: { options: { defaults: {
|
|
58
58
|
gender: { male: 'Male', female: 'Female'}
|
|
59
59
|
} } } ) do
|
|
@@ -245,6 +245,23 @@ class CollectionCheckBoxesInputTest < ActionView::TestCase
|
|
|
245
245
|
end
|
|
246
246
|
end
|
|
247
247
|
|
|
248
|
+
test 'input check boxes with nested style renders item labels with specified class' do
|
|
249
|
+
swap SimpleForm, boolean_style: :nested do
|
|
250
|
+
with_input_for @user, :active, :check_boxes, item_label_class: "test"
|
|
251
|
+
|
|
252
|
+
assert_select 'span.checkbox > label.test > input'
|
|
253
|
+
end
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
test 'input check boxes with nested style and falsey input wrapper renders item labels with specified class' do
|
|
257
|
+
swap SimpleForm, boolean_style: :nested, item_wrapper_tag: false do
|
|
258
|
+
with_input_for @user, :active, :check_boxes, item_label_class: "checkbox-inline"
|
|
259
|
+
|
|
260
|
+
assert_select 'label.checkbox-inline > input'
|
|
261
|
+
assert_no_select 'span.checkbox'
|
|
262
|
+
end
|
|
263
|
+
end
|
|
264
|
+
|
|
248
265
|
test 'input check boxes wrapper class are not included when set to falsey' do
|
|
249
266
|
swap SimpleForm, include_default_input_wrapper_class: false, boolean_style: :nested do
|
|
250
267
|
with_input_for @user, :gender, :check_boxes, collection: [:male, :female]
|
|
@@ -261,4 +278,26 @@ class CollectionCheckBoxesInputTest < ActionView::TestCase
|
|
|
261
278
|
assert_select 'span.custom'
|
|
262
279
|
end
|
|
263
280
|
end
|
|
281
|
+
|
|
282
|
+
test 'input check boxes with nested style and namespace uses the right for attribute' do
|
|
283
|
+
swap SimpleForm, include_default_input_wrapper_class: false, boolean_style: :nested do
|
|
284
|
+
with_concat_form_for @user, namespace: :foo do |f|
|
|
285
|
+
concat f.input :gender, as: :check_boxes, collection: [:male, :female]
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
assert_select 'label[for=foo_user_gender_male]'
|
|
289
|
+
assert_select 'label[for=foo_user_gender_female]'
|
|
290
|
+
end
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
test 'input check boxes with nested style and index uses the right for attribute' do
|
|
294
|
+
swap SimpleForm, include_default_input_wrapper_class: false, boolean_style: :nested do
|
|
295
|
+
with_concat_form_for @user, index: 1 do |f|
|
|
296
|
+
concat f.input :gender, as: :check_boxes, collection: [:male, :female]
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
assert_select 'label[for=user_1_gender_male]'
|
|
300
|
+
assert_select 'label[for=user_1_gender_female]'
|
|
301
|
+
end
|
|
302
|
+
end
|
|
264
303
|
end
|
|
@@ -6,19 +6,19 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
|
|
|
6
6
|
SimpleForm::Inputs::CollectionRadioButtonsInput.reset_i18n_cache :boolean_collection
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
test 'input
|
|
9
|
+
test 'input generates boolean radio buttons by default for radio types' do
|
|
10
10
|
with_input_for @user, :active, :radio_buttons
|
|
11
11
|
assert_select 'input[type=radio][value=true].radio_buttons#user_active_true'
|
|
12
12
|
assert_select 'input[type=radio][value=false].radio_buttons#user_active_false'
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
test 'input as radio
|
|
15
|
+
test 'input as radio generates internal labels by default' do
|
|
16
16
|
with_input_for @user, :active, :radio_buttons
|
|
17
17
|
assert_select 'label[for=user_active_true]', 'Yes'
|
|
18
18
|
assert_select 'label[for=user_active_false]', 'No'
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
test 'input as radio
|
|
21
|
+
test 'input as radio generates internal labels with accurate `for` values with nested boolean style' do
|
|
22
22
|
swap SimpleForm, boolean_style: :nested do
|
|
23
23
|
with_input_for @user, :active, :radio_buttons
|
|
24
24
|
assert_select 'label[for=user_active_true]', 'Yes'
|
|
@@ -26,7 +26,7 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
|
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
test 'nested label
|
|
29
|
+
test 'nested label does not duplicate input id' do
|
|
30
30
|
swap SimpleForm, boolean_style: :nested do
|
|
31
31
|
with_input_for @user, :active, :radio_buttons, id: 'nested_id'
|
|
32
32
|
assert_select 'input#user_active_true'
|
|
@@ -34,7 +34,7 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
|
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
test 'input as radio
|
|
37
|
+
test 'input as radio uses i18n to translate internal labels' do
|
|
38
38
|
store_translations(:en, simple_form: { yes: 'Sim', no: 'Não' }) do
|
|
39
39
|
with_input_for @user, :active, :radio_buttons
|
|
40
40
|
assert_select 'label[for=user_active_true]', 'Sim'
|
|
@@ -42,25 +42,25 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
|
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
test 'input radio
|
|
45
|
+
test 'input radio does not include for attribute by default' do
|
|
46
46
|
with_input_for @user, :gender, :radio_buttons, collection: [:male, :female]
|
|
47
47
|
assert_select 'label'
|
|
48
48
|
assert_no_select 'label[for=user_gender]'
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
-
test 'input radio
|
|
51
|
+
test 'input radio includes for attribute when giving as html option' do
|
|
52
52
|
with_input_for @user, :gender, :radio_buttons, collection: [:male, :female], label_html: { for: 'gender' }
|
|
53
53
|
assert_select 'label[for=gender]'
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
test 'input
|
|
56
|
+
test 'input marks the checked value when using boolean and radios' do
|
|
57
57
|
@user.active = false
|
|
58
58
|
with_input_for @user, :active, :radio_buttons
|
|
59
59
|
assert_no_select 'input[type=radio][value=true][checked]'
|
|
60
60
|
assert_select 'input[type=radio][value=false][checked]'
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
-
test 'input
|
|
63
|
+
test 'input allows overriding collection for radio types' do
|
|
64
64
|
with_input_for @user, :name, :radio_buttons, collection: ['Jose', 'Carlos']
|
|
65
65
|
assert_select 'input[type=radio][value=Jose]'
|
|
66
66
|
assert_select 'input[type=radio][value=Carlos]'
|
|
@@ -68,7 +68,7 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
|
|
|
68
68
|
assert_select 'label.collection_radio_buttons[for=user_name_carlos]', 'Carlos'
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
-
test 'input
|
|
71
|
+
test 'input does automatic collection translation for radio types using defaults key' do
|
|
72
72
|
store_translations(:en, simple_form: { options: { defaults: {
|
|
73
73
|
gender: { male: 'Male', female: 'Female'}
|
|
74
74
|
} } } ) do
|
|
@@ -80,7 +80,7 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
|
|
|
80
80
|
end
|
|
81
81
|
end
|
|
82
82
|
|
|
83
|
-
test 'input
|
|
83
|
+
test 'input does automatic collection translation for radio types using specific object key' do
|
|
84
84
|
store_translations(:en, simple_form: { options: { user: {
|
|
85
85
|
gender: { male: 'Male', female: 'Female'}
|
|
86
86
|
} } } ) do
|
|
@@ -92,7 +92,7 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
|
|
|
92
92
|
end
|
|
93
93
|
end
|
|
94
94
|
|
|
95
|
-
test 'input
|
|
95
|
+
test 'input does automatic collection translation and preserve html markup' do
|
|
96
96
|
swap SimpleForm, boolean_style: :nested do
|
|
97
97
|
store_translations(:en, simple_form: { options: { user: {
|
|
98
98
|
gender: { male_html: '<strong>Male</strong>', female_html: '<strong>Female</strong>' }
|
|
@@ -100,13 +100,13 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
|
|
|
100
100
|
with_input_for @user, :gender, :radio_buttons, collection: [:male, :female]
|
|
101
101
|
assert_select 'input[type=radio][value=male]'
|
|
102
102
|
assert_select 'input[type=radio][value=female]'
|
|
103
|
-
assert_select 'label[for=user_gender_male]', 'Male'
|
|
104
|
-
assert_select 'label[for=user_gender_female]', 'Female'
|
|
103
|
+
assert_select 'label[for=user_gender_male] strong', 'Male'
|
|
104
|
+
assert_select 'label[for=user_gender_female] strong', 'Female'
|
|
105
105
|
end
|
|
106
106
|
end
|
|
107
107
|
end
|
|
108
108
|
|
|
109
|
-
test 'input
|
|
109
|
+
test 'input does automatic collection translation with keys prefixed with _html and a string value' do
|
|
110
110
|
swap SimpleForm, boolean_style: :nested do
|
|
111
111
|
store_translations(:en, simple_form: { options: { user: {
|
|
112
112
|
gender: { male_html: 'Male', female_html: 'Female' }
|
|
@@ -120,18 +120,18 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
|
|
|
120
120
|
end
|
|
121
121
|
end
|
|
122
122
|
|
|
123
|
-
test 'input
|
|
123
|
+
test 'input marks the current radio value by default' do
|
|
124
124
|
@user.name = "Carlos"
|
|
125
125
|
with_input_for @user, :name, :radio_buttons, collection: ['Jose', 'Carlos']
|
|
126
126
|
assert_select 'input[type=radio][value=Carlos][checked=checked]'
|
|
127
127
|
end
|
|
128
128
|
|
|
129
|
-
test 'input
|
|
129
|
+
test 'input accepts html options as the last element of collection' do
|
|
130
130
|
with_input_for @user, :name, :radio_buttons, collection: [['Jose', 'jose', class: 'foo']]
|
|
131
131
|
assert_select 'input.foo[type=radio][value=jose]'
|
|
132
132
|
end
|
|
133
133
|
|
|
134
|
-
test 'input
|
|
134
|
+
test 'input allows using a collection with text/value arrays' do
|
|
135
135
|
with_input_for @user, :name, :radio_buttons, collection: [['Jose', 'jose'], ['Carlos', 'carlos']]
|
|
136
136
|
assert_select 'input[type=radio][value=jose]'
|
|
137
137
|
assert_select 'input[type=radio][value=carlos]'
|
|
@@ -139,13 +139,13 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
|
|
|
139
139
|
assert_select 'label.collection_radio_buttons', 'Carlos'
|
|
140
140
|
end
|
|
141
141
|
|
|
142
|
-
test 'input
|
|
142
|
+
test 'input allows using a collection with a Proc' do
|
|
143
143
|
with_input_for @user, :name, :radio_buttons, collection: Proc.new { ['Jose', 'Carlos' ] }
|
|
144
144
|
assert_select 'label.collection_radio_buttons', 'Jose'
|
|
145
145
|
assert_select 'label.collection_radio_buttons', 'Carlos'
|
|
146
146
|
end
|
|
147
147
|
|
|
148
|
-
test 'input
|
|
148
|
+
test 'input allows overriding only label method for collections' do
|
|
149
149
|
with_input_for @user, :name, :radio_buttons,
|
|
150
150
|
collection: ['Jose', 'Carlos'],
|
|
151
151
|
label_method: :upcase
|
|
@@ -153,7 +153,7 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
|
|
|
153
153
|
assert_select 'label.collection_radio_buttons', 'CARLOS'
|
|
154
154
|
end
|
|
155
155
|
|
|
156
|
-
test 'input
|
|
156
|
+
test 'input allows overriding only value method for collections' do
|
|
157
157
|
with_input_for @user, :name, :radio_buttons,
|
|
158
158
|
collection: ['Jose', 'Carlos'],
|
|
159
159
|
value_method: :upcase
|
|
@@ -161,7 +161,7 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
|
|
|
161
161
|
assert_select 'input[type=radio][value=CARLOS]'
|
|
162
162
|
end
|
|
163
163
|
|
|
164
|
-
test 'input
|
|
164
|
+
test 'input allows overriding label and value method for collections' do
|
|
165
165
|
with_input_for @user, :name, :radio_buttons,
|
|
166
166
|
collection: ['Jose', 'Carlos'],
|
|
167
167
|
label_method: :upcase,
|
|
@@ -172,7 +172,7 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
|
|
|
172
172
|
assert_select 'label.collection_radio_buttons', 'CARLOS'
|
|
173
173
|
end
|
|
174
174
|
|
|
175
|
-
test 'input
|
|
175
|
+
test 'input allows overriding label and value method using a lambda for collections' do
|
|
176
176
|
with_input_for @user, :name, :radio_buttons,
|
|
177
177
|
collection: ['Jose', 'Carlos'],
|
|
178
178
|
label_method: lambda { |i| i.upcase },
|
|
@@ -183,13 +183,13 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
|
|
|
183
183
|
assert_select 'label.collection_radio_buttons', 'CARLOS'
|
|
184
184
|
end
|
|
185
185
|
|
|
186
|
-
test 'collection input with radio type
|
|
186
|
+
test 'collection input with radio type generates required html attribute' do
|
|
187
187
|
with_input_for @user, :name, :radio_buttons, collection: ['Jose', 'Carlos']
|
|
188
188
|
assert_select 'input[type=radio].required'
|
|
189
189
|
assert_select 'input[type=radio][required]'
|
|
190
190
|
end
|
|
191
191
|
|
|
192
|
-
test 'collection input with radio type
|
|
192
|
+
test 'collection input with radio type generates aria-required html attribute' do
|
|
193
193
|
with_input_for @user, :name, :radio_buttons, collection: ['Jose', 'Carlos']
|
|
194
194
|
assert_select 'input[type=radio].required'
|
|
195
195
|
assert_select 'input[type=radio][aria-required=true]'
|
|
@@ -368,6 +368,23 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
|
|
|
368
368
|
end
|
|
369
369
|
end
|
|
370
370
|
|
|
371
|
+
test 'input radio with nested style renders item labels with specified class' do
|
|
372
|
+
swap SimpleForm, boolean_style: :nested do
|
|
373
|
+
with_input_for @user, :active, :radio_buttons, item_label_class: "test"
|
|
374
|
+
|
|
375
|
+
assert_select 'span.radio > label.test > input'
|
|
376
|
+
end
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
test 'input radio with nested style and falsey input wrapper renders item labels with specified class' do
|
|
380
|
+
swap SimpleForm, boolean_style: :nested, item_wrapper_tag: false do
|
|
381
|
+
with_input_for @user, :active, :radio_buttons, item_label_class: "radio-inline"
|
|
382
|
+
|
|
383
|
+
assert_select 'label.radio-inline > input'
|
|
384
|
+
assert_no_select 'span.radio'
|
|
385
|
+
end
|
|
386
|
+
end
|
|
387
|
+
|
|
371
388
|
test 'input radio wrapper class are not included when set to falsey' do
|
|
372
389
|
swap SimpleForm, include_default_input_wrapper_class: false, boolean_style: :nested do
|
|
373
390
|
with_input_for @user, :gender, :radio_buttons, collection: [:male, :female]
|
|
@@ -376,7 +393,7 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
|
|
|
376
393
|
end
|
|
377
394
|
end
|
|
378
395
|
|
|
379
|
-
test 'input
|
|
396
|
+
test 'input radio custom wrapper class is included when include input wrapper class is falsey' do
|
|
380
397
|
swap SimpleForm, include_default_input_wrapper_class: false, boolean_style: :nested do
|
|
381
398
|
with_input_for @user, :gender, :radio_buttons, collection: [:male, :female], item_wrapper_class: 'custom'
|
|
382
399
|
|
|
@@ -384,4 +401,26 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
|
|
|
384
401
|
assert_select 'span.custom'
|
|
385
402
|
end
|
|
386
403
|
end
|
|
404
|
+
|
|
405
|
+
test 'input radio with nested style and namespace uses the right for attribute' do
|
|
406
|
+
swap SimpleForm, include_default_input_wrapper_class: false, boolean_style: :nested do
|
|
407
|
+
with_concat_form_for @user, namespace: :foo do |f|
|
|
408
|
+
concat f.input :gender, as: :radio_buttons, collection: [:male, :female]
|
|
409
|
+
end
|
|
410
|
+
|
|
411
|
+
assert_select 'label[for=foo_user_gender_male]'
|
|
412
|
+
assert_select 'label[for=foo_user_gender_female]'
|
|
413
|
+
end
|
|
414
|
+
end
|
|
415
|
+
|
|
416
|
+
test 'input radio with nested style and index uses the right for attribute' do
|
|
417
|
+
swap SimpleForm, include_default_input_wrapper_class: false, boolean_style: :nested do
|
|
418
|
+
with_concat_form_for @user, index: 1 do |f|
|
|
419
|
+
concat f.input :gender, as: :radio_buttons, collection: [:male, :female]
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
assert_select 'label[for=user_1_gender_male]'
|
|
423
|
+
assert_select 'label[for=user_1_gender_female]'
|
|
424
|
+
end
|
|
425
|
+
end
|
|
387
426
|
end
|