decidim-forms 0.28.4 → 0.29.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/cells/decidim/forms/question_readonly_cell.rb +0 -2
- data/app/cells/decidim/forms/step_navigation/show.erb +3 -3
- data/app/cells/decidim/forms/step_navigation_cell.rb +2 -3
- data/app/commands/decidim/forms/answer_questionnaire.rb +4 -4
- data/app/controllers/decidim/forms/concerns/has_questionnaire.rb +1 -1
- data/app/forms/decidim/forms/answer_form.rb +2 -2
- data/app/forms/decidim/forms/questionnaire_form.rb +1 -1
- data/app/helpers/decidim/forms/application_helper.rb +2 -2
- data/app/models/decidim/forms/answer_option.rb +1 -1
- data/app/models/decidim/forms/display_condition.rb +11 -3
- data/app/models/decidim/forms/question_matrix_row.rb +1 -1
- data/app/presenters/decidim/forms/admin/questionnaire_participant_presenter.rb +7 -7
- data/app/views/decidim/forms/admin/questionnaires/_answer_option.html.erb +1 -1
- data/app/views/decidim/forms/admin/questionnaires/_display_condition.html.erb +2 -2
- data/app/views/decidim/forms/admin/questionnaires/_matrix_row.html.erb +1 -1
- data/app/views/decidim/forms/admin/questionnaires/_question.html.erb +4 -4
- data/app/views/decidim/forms/admin/questionnaires/_separator.html.erb +4 -4
- data/app/views/decidim/forms/admin/questionnaires/_title_and_description.html.erb +4 -4
- data/config/initializers/wicked_pdf.rb +5 -5
- data/config/locales/ar.yml +0 -1
- data/config/locales/bg.yml +1 -2
- data/config/locales/ca.yml +1 -1
- data/config/locales/cs.yml +0 -1
- data/config/locales/de.yml +1 -1
- data/config/locales/el.yml +0 -2
- data/config/locales/en.yml +2 -2
- data/config/locales/es-MX.yml +2 -2
- data/config/locales/es-PY.yml +2 -2
- data/config/locales/es.yml +2 -2
- data/config/locales/eu.yml +1 -1
- data/config/locales/fi-plain.yml +1 -1
- data/config/locales/fi.yml +2 -2
- data/config/locales/fr-CA.yml +1 -1
- data/config/locales/fr.yml +1 -1
- data/config/locales/gl.yml +0 -1
- data/config/locales/hu.yml +3 -4
- data/config/locales/id-ID.yml +0 -1
- data/config/locales/it.yml +0 -1
- data/config/locales/ja.yml +1 -1
- data/config/locales/lb.yml +0 -1
- data/config/locales/lt.yml +0 -2
- data/config/locales/lv.yml +0 -1
- data/config/locales/nl.yml +0 -1
- data/config/locales/no.yml +0 -1
- data/config/locales/pl.yml +1 -1
- data/config/locales/pt-BR.yml +0 -1
- data/config/locales/pt.yml +0 -1
- data/config/locales/ro-RO.yml +0 -2
- data/config/locales/sk.yml +0 -1
- data/config/locales/sv.yml +29 -47
- data/config/locales/tr-TR.yml +0 -1
- data/config/locales/zh-CN.yml +0 -1
- data/config/locales/zh-TW.yml +0 -2
- data/db/migrate/20240402092039_add_answer_options_counter_cache_to_questions.rb +16 -0
- data/db/migrate/20240402095253_add_matrix_row_counter_cache_to_questions.rb +16 -0
- data/db/migrate/20240416111953_add_display_conditions_counter_cache_to_questions.rb +16 -0
- data/db/migrate/20240416113926_add_display_conditions_for_other_questions_counter_cache_to_questions.rb +16 -0
- data/decidim-forms.gemspec +1 -1
- data/lib/decidim/forms/test/shared_examples/has_questionnaire.rb +44 -44
- data/lib/decidim/forms/test/shared_examples/manage_questionnaire_answers.rb +12 -12
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_display_conditions.rb +10 -10
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_questions.rb +85 -85
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_display_conditions.rb +8 -8
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb +82 -82
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires.rb +9 -9
- data/lib/decidim/forms/version.rb +1 -1
- metadata +16 -12
@@ -5,24 +5,24 @@ require "spec_helper"
|
|
5
5
|
shared_examples_for "add questions" do
|
6
6
|
shared_examples_for "updating the max choices selector according to the configured options" do
|
7
7
|
it "updates them" do
|
8
|
-
expect(page).
|
8
|
+
expect(page).to have_no_select("Maximum number of choices")
|
9
9
|
|
10
10
|
select "Multiple option", from: "Type"
|
11
11
|
expect(page).to have_select("Maximum number of choices", options: %w(Any 2))
|
12
12
|
|
13
|
-
|
13
|
+
click_on "Add answer option"
|
14
14
|
expect(page).to have_select("Maximum number of choices", options: %w(Any 2 3))
|
15
15
|
|
16
|
-
|
16
|
+
click_on "Add answer option"
|
17
17
|
expect(page).to have_select("Maximum number of choices", options: %w(Any 2 3 4))
|
18
18
|
|
19
|
-
within(".questionnaire-question-answer-option:last-of-type") {
|
19
|
+
within(".questionnaire-question-answer-option:last-of-type") { click_on "Remove" }
|
20
20
|
expect(page).to have_select("Maximum number of choices", options: %w(Any 2 3))
|
21
21
|
|
22
|
-
within(".questionnaire-question-answer-option:last-of-type") {
|
22
|
+
within(".questionnaire-question-answer-option:last-of-type") { click_on "Remove" }
|
23
23
|
expect(page).to have_select("Maximum number of choices", options: %w(Any 2))
|
24
24
|
|
25
|
-
|
25
|
+
click_on "Add question"
|
26
26
|
expand_all_questions
|
27
27
|
|
28
28
|
within(".questionnaire-question:last-of-type") do
|
@@ -30,7 +30,7 @@ shared_examples_for "add questions" do
|
|
30
30
|
expect(page).to have_select("Maximum number of choices", options: %w(Any 2))
|
31
31
|
|
32
32
|
select single_option_string, from: "Type"
|
33
|
-
expect(page).
|
33
|
+
expect(page).to have_no_select("Maximum number of choices")
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -39,12 +39,12 @@ shared_examples_for "add questions" do
|
|
39
39
|
fields_body = ["This is the first question", "This is the second question", "This is the first title and description"]
|
40
40
|
|
41
41
|
within "form.edit_questionnaire" do
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
click_on "Add question"
|
43
|
+
click_on "Add separator"
|
44
|
+
click_on "Add title and description"
|
45
|
+
click_on "Add question"
|
46
46
|
|
47
|
-
expect(page).to
|
47
|
+
expect(page).to have_css(".questionnaire-question", count: 4)
|
48
48
|
|
49
49
|
expand_all_questions
|
50
50
|
|
@@ -54,22 +54,22 @@ shared_examples_for "add questions" do
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
|
57
|
+
click_on "Save"
|
58
58
|
end
|
59
59
|
|
60
60
|
expect(page).to have_admin_callout("successfully")
|
61
61
|
|
62
62
|
visit_questionnaire_edit_path_and_expand_all
|
63
63
|
|
64
|
-
expect(page).to
|
65
|
-
expect(page).to
|
66
|
-
expect(page).to
|
64
|
+
expect(page).to have_css("input[value='This is the first question']")
|
65
|
+
expect(page).to have_css("input[value='This is the second question']")
|
66
|
+
expect(page).to have_css("input[value='This is the first title and description']")
|
67
67
|
expect(page).to have_content("Separator #2")
|
68
68
|
end
|
69
69
|
|
70
70
|
it "adds a question with a rich text description" do
|
71
71
|
within "form.edit_questionnaire" do
|
72
|
-
|
72
|
+
click_on "Add question"
|
73
73
|
expand_all_questions
|
74
74
|
|
75
75
|
within ".questionnaire-question" do
|
@@ -78,7 +78,7 @@ shared_examples_for "add questions" do
|
|
78
78
|
fill_in_editor find_nested_form_field_locator("description_en", visible: false), with: "<p>\n<strong>Superkalifragilistic description</strong>\n</p>"
|
79
79
|
end
|
80
80
|
|
81
|
-
|
81
|
+
click_on "Save"
|
82
82
|
end
|
83
83
|
|
84
84
|
expect(page).to have_admin_callout("successfully")
|
@@ -93,12 +93,12 @@ shared_examples_for "add questions" do
|
|
93
93
|
|
94
94
|
visit questionnaire_public_path
|
95
95
|
|
96
|
-
expect(page).to
|
96
|
+
expect(page).to have_css("strong", text: "Superkalifragilistic description")
|
97
97
|
end
|
98
98
|
|
99
99
|
it "adds a title-and-description" do
|
100
100
|
within "form.edit_questionnaire" do
|
101
|
-
|
101
|
+
click_on "Add title and description"
|
102
102
|
expand_all_questions
|
103
103
|
|
104
104
|
within ".questionnaire-question" do
|
@@ -107,7 +107,7 @@ shared_examples_for "add questions" do
|
|
107
107
|
fill_in_editor find_nested_form_field_locator("description_en", visible: false), with: "<p>\n<strong>Superkalifragilistic description</strong>\n</p>"
|
108
108
|
end
|
109
109
|
|
110
|
-
|
110
|
+
click_on "Save"
|
111
111
|
end
|
112
112
|
|
113
113
|
expect(page).to have_admin_callout("successfully")
|
@@ -122,7 +122,7 @@ shared_examples_for "add questions" do
|
|
122
122
|
|
123
123
|
visit questionnaire_public_path
|
124
124
|
|
125
|
-
expect(page).to
|
125
|
+
expect(page).to have_css("strong", text: "Superkalifragilistic description")
|
126
126
|
end
|
127
127
|
|
128
128
|
it "adds a question with answer options" do
|
@@ -141,8 +141,8 @@ shared_examples_for "add questions" do
|
|
141
141
|
]
|
142
142
|
|
143
143
|
within "form.edit_questionnaire" do
|
144
|
-
|
145
|
-
|
144
|
+
click_on "Add question"
|
145
|
+
click_on "Add question"
|
146
146
|
expand_all_questions
|
147
147
|
|
148
148
|
page.all(".questionnaire-question").each_with_index do |question, idx|
|
@@ -151,12 +151,12 @@ shared_examples_for "add questions" do
|
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
154
|
-
expect(page).
|
154
|
+
expect(page).to have_no_content "Add answer option"
|
155
155
|
|
156
156
|
page.all(".questionnaire-question").each do |question|
|
157
157
|
within question do
|
158
158
|
select "Single option", from: "Type"
|
159
|
-
|
159
|
+
click_on "Add answer option"
|
160
160
|
end
|
161
161
|
end
|
162
162
|
|
@@ -168,58 +168,58 @@ shared_examples_for "add questions" do
|
|
168
168
|
end
|
169
169
|
end
|
170
170
|
|
171
|
-
|
171
|
+
click_on "Save"
|
172
172
|
end
|
173
173
|
|
174
174
|
expect(page).to have_admin_callout("successfully")
|
175
175
|
|
176
176
|
visit_questionnaire_edit_path_and_expand_all
|
177
177
|
|
178
|
-
expect(page).to
|
179
|
-
expect(page).to
|
180
|
-
expect(page).to
|
181
|
-
expect(page).to
|
182
|
-
expect(page).to
|
183
|
-
expect(page).to
|
184
|
-
expect(page).to
|
185
|
-
expect(page).to
|
178
|
+
expect(page).to have_css("input[value='This is the first question']")
|
179
|
+
expect(page).to have_css("input[value='This is the Q1 first option']")
|
180
|
+
expect(page).to have_css("input[value='This is the Q1 second option']")
|
181
|
+
expect(page).to have_css("input[value='This is the Q1 third option']")
|
182
|
+
expect(page).to have_css("input[value='This is the second question']")
|
183
|
+
expect(page).to have_css("input[value='This is the Q2 first option']")
|
184
|
+
expect(page).to have_css("input[value='This is the Q2 second option']")
|
185
|
+
expect(page).to have_css("input[value='This is the Q2 third option']")
|
186
186
|
end
|
187
187
|
|
188
188
|
it "adds a sane number of options for each attribute type" do
|
189
|
-
|
189
|
+
click_on "Add question"
|
190
190
|
expand_all_questions
|
191
191
|
|
192
192
|
select "Long answer", from: "Type"
|
193
|
-
expect(page).
|
194
|
-
expect(page).
|
193
|
+
expect(page).to have_no_css(".questionnaire-question-answer-option")
|
194
|
+
expect(page).to have_no_css(".questionnaire-question-matrix-row")
|
195
195
|
|
196
196
|
select "Single option", from: "Type"
|
197
|
-
expect(page).to
|
198
|
-
expect(page).
|
197
|
+
expect(page).to have_css(".questionnaire-question-answer-option", count: 2)
|
198
|
+
expect(page).to have_no_css(".questionnaire-question-matrix-row")
|
199
199
|
|
200
200
|
select "Multiple option", from: "Type"
|
201
|
-
expect(page).to
|
202
|
-
expect(page).
|
201
|
+
expect(page).to have_css(".questionnaire-question-answer-option", count: 2)
|
202
|
+
expect(page).to have_no_css(".questionnaire-question-matrix-row")
|
203
203
|
|
204
204
|
select "Matrix (Multiple option)", from: "Type"
|
205
|
-
expect(page).to
|
206
|
-
expect(page).to
|
205
|
+
expect(page).to have_css(".questionnaire-question-answer-option", count: 2)
|
206
|
+
expect(page).to have_css(".questionnaire-question-matrix-row", count: 2)
|
207
207
|
|
208
208
|
select "Short answer", from: "Type"
|
209
|
-
expect(page).
|
210
|
-
expect(page).
|
209
|
+
expect(page).to have_no_css(".questionnaire-question-answer-option")
|
210
|
+
expect(page).to have_no_css(".questionnaire-question-matrix-row")
|
211
211
|
|
212
212
|
select "Matrix (Single option)", from: "Type"
|
213
|
-
expect(page).to
|
214
|
-
expect(page).to
|
213
|
+
expect(page).to have_css(".questionnaire-question-answer-option", count: 2)
|
214
|
+
expect(page).to have_css(".questionnaire-question-matrix-row", count: 2)
|
215
215
|
end
|
216
216
|
|
217
217
|
it "does not incorrectly reorder when clicking answer options" do
|
218
|
-
|
218
|
+
click_on "Add question"
|
219
219
|
expand_all_questions
|
220
220
|
|
221
221
|
select "Single option", from: "Type"
|
222
|
-
2.times {
|
222
|
+
2.times { click_on "Add answer option" }
|
223
223
|
|
224
224
|
within ".questionnaire-question-answer-option:first-of-type" do
|
225
225
|
fill_in find_nested_form_field_locator("body_en"), with: "Something"
|
@@ -245,11 +245,11 @@ shared_examples_for "add questions" do
|
|
245
245
|
end
|
246
246
|
|
247
247
|
it "does not incorrectly reorder when clicking matrix rows" do
|
248
|
-
|
248
|
+
click_on "Add question"
|
249
249
|
expand_all_questions
|
250
250
|
|
251
251
|
select "Matrix (Multiple option)", from: "Type"
|
252
|
-
2.times {
|
252
|
+
2.times { click_on "Add row" }
|
253
253
|
|
254
254
|
within ".questionnaire-question-matrix-row:first-of-type" do
|
255
255
|
fill_in find_nested_form_field_locator("body_en"), with: "Something"
|
@@ -275,18 +275,18 @@ shared_examples_for "add questions" do
|
|
275
275
|
end
|
276
276
|
|
277
277
|
it "preserves question form across submission failures" do
|
278
|
-
|
278
|
+
click_on "Add question"
|
279
279
|
expand_all_questions
|
280
280
|
|
281
281
|
select "Long answer", from: "Type"
|
282
|
-
|
282
|
+
click_on "Save"
|
283
283
|
|
284
284
|
expand_all_questions
|
285
285
|
expect(page).to have_select("Type", selected: "Long answer")
|
286
286
|
end
|
287
287
|
|
288
288
|
it "does not preserve spurious answer options from previous type selections" do
|
289
|
-
|
289
|
+
click_on "Add question"
|
290
290
|
expand_all_questions
|
291
291
|
|
292
292
|
select "Single option", from: "Type"
|
@@ -297,7 +297,7 @@ shared_examples_for "add questions" do
|
|
297
297
|
|
298
298
|
select "Long answer", from: "Type"
|
299
299
|
|
300
|
-
|
300
|
+
click_on "Save"
|
301
301
|
expand_all_questions
|
302
302
|
|
303
303
|
select "Single option", from: "Type"
|
@@ -308,7 +308,7 @@ shared_examples_for "add questions" do
|
|
308
308
|
end
|
309
309
|
|
310
310
|
it "does not preserve spurious matrix rows from previous type selections" do
|
311
|
-
|
311
|
+
click_on "Add question"
|
312
312
|
expand_all_questions
|
313
313
|
|
314
314
|
select "Matrix (Single option)", from: "Type"
|
@@ -319,7 +319,7 @@ shared_examples_for "add questions" do
|
|
319
319
|
|
320
320
|
select "Long answer", from: "Type"
|
321
321
|
|
322
|
-
|
322
|
+
click_on "Save"
|
323
323
|
expand_all_questions
|
324
324
|
|
325
325
|
select "Matrix (Single option)", from: "Type"
|
@@ -330,7 +330,7 @@ shared_examples_for "add questions" do
|
|
330
330
|
end
|
331
331
|
|
332
332
|
it "preserves answer options form across submission failures" do
|
333
|
-
|
333
|
+
click_on "Add question"
|
334
334
|
expand_all_questions
|
335
335
|
|
336
336
|
select "Multiple option", from: "Type"
|
@@ -339,7 +339,7 @@ shared_examples_for "add questions" do
|
|
339
339
|
fill_in find_nested_form_field_locator("body_en"), with: "Something"
|
340
340
|
end
|
341
341
|
|
342
|
-
|
342
|
+
click_on "Add answer option"
|
343
343
|
|
344
344
|
within ".questionnaire-question-answer-option:last-of-type" do
|
345
345
|
fill_in find_nested_form_field_locator("body_en"), with: "Else"
|
@@ -347,7 +347,7 @@ shared_examples_for "add questions" do
|
|
347
347
|
|
348
348
|
select "3", from: "Maximum number of choices"
|
349
349
|
|
350
|
-
|
350
|
+
click_on "Save"
|
351
351
|
expand_all_questions
|
352
352
|
|
353
353
|
within ".questionnaire-question-answer-option:first-of-type" do
|
@@ -362,7 +362,7 @@ shared_examples_for "add questions" do
|
|
362
362
|
end
|
363
363
|
|
364
364
|
it "preserves matrix rows form across submission failures" do
|
365
|
-
|
365
|
+
click_on "Add question"
|
366
366
|
expand_all_questions
|
367
367
|
|
368
368
|
select "Matrix (Multiple option)", from: "Type"
|
@@ -371,9 +371,9 @@ shared_examples_for "add questions" do
|
|
371
371
|
fill_in find_nested_form_field_locator("body_en"), with: "Something"
|
372
372
|
end
|
373
373
|
|
374
|
-
|
374
|
+
click_on "Add row"
|
375
375
|
|
376
|
-
|
376
|
+
click_on "Save"
|
377
377
|
expand_all_questions
|
378
378
|
|
379
379
|
within ".questionnaire-question-matrix-row:first-of-type" do
|
@@ -382,21 +382,21 @@ shared_examples_for "add questions" do
|
|
382
382
|
end
|
383
383
|
|
384
384
|
it "allows switching translated field tabs after form failures" do
|
385
|
-
|
386
|
-
|
385
|
+
click_on "Add question"
|
386
|
+
click_on "Save"
|
387
387
|
|
388
388
|
expand_all_questions
|
389
389
|
|
390
390
|
within ".questionnaire-question:first-of-type" do
|
391
391
|
fill_in find_nested_form_field_locator("body_en"), with: "Bye"
|
392
|
-
|
392
|
+
click_on "Català", match: :first
|
393
393
|
|
394
394
|
fill_in find_nested_form_field_locator("body_ca"), with: "Adeu"
|
395
|
-
|
395
|
+
click_on "English", match: :first
|
396
396
|
|
397
397
|
expect(page).to have_nested_field("body_en", with: "Bye")
|
398
|
-
expect(page).
|
399
|
-
expect(page).
|
398
|
+
expect(page).to have_no_selector(nested_form_field_selector("body_ca"))
|
399
|
+
expect(page).to have_no_content("Adeu")
|
400
400
|
end
|
401
401
|
end
|
402
402
|
|
@@ -408,7 +408,7 @@ shared_examples_for "add questions" do
|
|
408
408
|
visit questionnaire_edit_path
|
409
409
|
|
410
410
|
within "form.edit_questionnaire" do
|
411
|
-
|
411
|
+
click_on "Add question"
|
412
412
|
|
413
413
|
expand_all_questions
|
414
414
|
|
@@ -416,22 +416,22 @@ shared_examples_for "add questions" do
|
|
416
416
|
fill_in find_nested_form_field_locator("body_en"), with: "This is the first question"
|
417
417
|
end
|
418
418
|
|
419
|
-
expect(page).
|
420
|
-
expect(page).
|
419
|
+
expect(page).to have_no_content "Add answer option"
|
420
|
+
expect(page).to have_no_select("Maximum number of choices")
|
421
421
|
end
|
422
422
|
end
|
423
423
|
|
424
424
|
it "updates the free text option selector according to the selected question type" do
|
425
|
-
expect(page).
|
425
|
+
expect(page).to have_no_css("input[type=checkbox][id$=_free_text]")
|
426
426
|
|
427
427
|
select "Multiple option", from: "Type"
|
428
|
-
expect(page).to
|
428
|
+
expect(page).to have_css("input[type=checkbox][id$=_free_text]")
|
429
429
|
|
430
430
|
select "Short answer", from: "Type"
|
431
|
-
expect(page).
|
431
|
+
expect(page).to have_no_css("input[type=checkbox][id$=_free_text]")
|
432
432
|
|
433
433
|
select "Single option", from: "Type"
|
434
|
-
expect(page).to
|
434
|
+
expect(page).to have_css("input[type=checkbox][id$=_free_text]")
|
435
435
|
end
|
436
436
|
|
437
437
|
it_behaves_like "updating the max choices selector according to the configured options"
|
@@ -445,30 +445,30 @@ shared_examples_for "add questions" do
|
|
445
445
|
visit questionnaire_edit_path
|
446
446
|
|
447
447
|
within "form.edit_questionnaire" do
|
448
|
-
|
448
|
+
click_on "Add question"
|
449
449
|
expand_all_questions
|
450
450
|
|
451
451
|
within ".questionnaire-question" do
|
452
452
|
fill_in find_nested_form_field_locator("body_en"), with: "This is the first question"
|
453
453
|
end
|
454
454
|
|
455
|
-
expect(page).
|
456
|
-
expect(page).
|
457
|
-
expect(page).
|
455
|
+
expect(page).to have_no_content "Add answer option"
|
456
|
+
expect(page).to have_no_content "Add row"
|
457
|
+
expect(page).to have_no_select("Maximum number of choices")
|
458
458
|
end
|
459
459
|
end
|
460
460
|
|
461
461
|
it "updates the free text option selector according to the selected question type" do
|
462
|
-
expect(page).
|
462
|
+
expect(page).to have_no_css("input[type=checkbox][id$=_free_text]")
|
463
463
|
|
464
464
|
select "Matrix (Multiple option)", from: "Type"
|
465
|
-
expect(page).to
|
465
|
+
expect(page).to have_css("input[type=checkbox][id$=_free_text]")
|
466
466
|
|
467
467
|
select "Short answer", from: "Type"
|
468
|
-
expect(page).
|
468
|
+
expect(page).to have_no_css("input[type=checkbox][id$=_free_text]")
|
469
469
|
|
470
470
|
select "Matrix (Single option)", from: "Type"
|
471
|
-
expect(page).to
|
471
|
+
expect(page).to have_css("input[type=checkbox][id$=_free_text]")
|
472
472
|
end
|
473
473
|
|
474
474
|
it_behaves_like "updating the max choices selector according to the configured options"
|
data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_display_conditions.rb
CHANGED
@@ -23,7 +23,7 @@ shared_examples_for "update display conditions" do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it "the related form appears" do
|
26
|
-
expect(page).to
|
26
|
+
expect(page).to have_css(".questionnaire-question-display-condition")
|
27
27
|
end
|
28
28
|
|
29
29
|
it "loads condition_question in select" do
|
@@ -54,19 +54,19 @@ shared_examples_for "update display conditions" do
|
|
54
54
|
|
55
55
|
it "can be removed" do
|
56
56
|
within ".questionnaire-question-display-condition:last-of-type" do
|
57
|
-
|
57
|
+
click_on "Remove"
|
58
58
|
end
|
59
59
|
|
60
|
-
|
60
|
+
click_on "Save"
|
61
61
|
|
62
62
|
visit_questionnaire_edit_path_and_expand_all
|
63
63
|
|
64
|
-
expect(page).to
|
64
|
+
expect(page).to have_css(".questionnaire-question-display-condition", count: 0)
|
65
65
|
end
|
66
66
|
|
67
67
|
it "still removes the question even if previous editions rendered the conditions invalid" do
|
68
68
|
within "form.edit_questionnaire" do
|
69
|
-
expect(page).to
|
69
|
+
expect(page).to have_css(".questionnaire-question", count: 2)
|
70
70
|
|
71
71
|
within ".questionnaire-question-display-condition:first-of-type" do
|
72
72
|
select condition_question.body["en"], from: "Question"
|
@@ -75,10 +75,10 @@ shared_examples_for "update display conditions" do
|
|
75
75
|
end
|
76
76
|
|
77
77
|
within ".questionnaire-question:last-of-type" do
|
78
|
-
|
78
|
+
click_on "Remove", match: :first
|
79
79
|
end
|
80
80
|
|
81
|
-
|
81
|
+
click_on "Save"
|
82
82
|
end
|
83
83
|
|
84
84
|
expect(page).to have_admin_callout("successfully")
|
@@ -86,7 +86,7 @@ shared_examples_for "update display conditions" do
|
|
86
86
|
visit_questionnaire_edit_path_and_expand_all
|
87
87
|
|
88
88
|
within "form.edit_questionnaire" do
|
89
|
-
expect(page).to
|
89
|
+
expect(page).to have_css(".questionnaire-question", count: 1)
|
90
90
|
end
|
91
91
|
end
|
92
92
|
end
|