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.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/forms/question_readonly_cell.rb +0 -2
  3. data/app/cells/decidim/forms/step_navigation/show.erb +3 -3
  4. data/app/cells/decidim/forms/step_navigation_cell.rb +2 -3
  5. data/app/commands/decidim/forms/answer_questionnaire.rb +4 -4
  6. data/app/controllers/decidim/forms/concerns/has_questionnaire.rb +1 -1
  7. data/app/forms/decidim/forms/answer_form.rb +2 -2
  8. data/app/forms/decidim/forms/questionnaire_form.rb +1 -1
  9. data/app/helpers/decidim/forms/application_helper.rb +2 -2
  10. data/app/models/decidim/forms/answer_option.rb +1 -1
  11. data/app/models/decidim/forms/display_condition.rb +11 -3
  12. data/app/models/decidim/forms/question_matrix_row.rb +1 -1
  13. data/app/presenters/decidim/forms/admin/questionnaire_participant_presenter.rb +7 -7
  14. data/app/views/decidim/forms/admin/questionnaires/_answer_option.html.erb +1 -1
  15. data/app/views/decidim/forms/admin/questionnaires/_display_condition.html.erb +2 -2
  16. data/app/views/decidim/forms/admin/questionnaires/_matrix_row.html.erb +1 -1
  17. data/app/views/decidim/forms/admin/questionnaires/_question.html.erb +4 -4
  18. data/app/views/decidim/forms/admin/questionnaires/_separator.html.erb +4 -4
  19. data/app/views/decidim/forms/admin/questionnaires/_title_and_description.html.erb +4 -4
  20. data/config/initializers/wicked_pdf.rb +5 -5
  21. data/config/locales/ar.yml +0 -1
  22. data/config/locales/bg.yml +1 -2
  23. data/config/locales/ca.yml +1 -1
  24. data/config/locales/cs.yml +0 -1
  25. data/config/locales/de.yml +1 -1
  26. data/config/locales/el.yml +0 -2
  27. data/config/locales/en.yml +2 -2
  28. data/config/locales/es-MX.yml +2 -2
  29. data/config/locales/es-PY.yml +2 -2
  30. data/config/locales/es.yml +2 -2
  31. data/config/locales/eu.yml +1 -1
  32. data/config/locales/fi-plain.yml +1 -1
  33. data/config/locales/fi.yml +2 -2
  34. data/config/locales/fr-CA.yml +1 -1
  35. data/config/locales/fr.yml +1 -1
  36. data/config/locales/gl.yml +0 -1
  37. data/config/locales/hu.yml +3 -4
  38. data/config/locales/id-ID.yml +0 -1
  39. data/config/locales/it.yml +0 -1
  40. data/config/locales/ja.yml +1 -1
  41. data/config/locales/lb.yml +0 -1
  42. data/config/locales/lt.yml +0 -2
  43. data/config/locales/lv.yml +0 -1
  44. data/config/locales/nl.yml +0 -1
  45. data/config/locales/no.yml +0 -1
  46. data/config/locales/pl.yml +1 -1
  47. data/config/locales/pt-BR.yml +0 -1
  48. data/config/locales/pt.yml +0 -1
  49. data/config/locales/ro-RO.yml +0 -2
  50. data/config/locales/sk.yml +0 -1
  51. data/config/locales/sv.yml +29 -47
  52. data/config/locales/tr-TR.yml +0 -1
  53. data/config/locales/zh-CN.yml +0 -1
  54. data/config/locales/zh-TW.yml +0 -2
  55. data/db/migrate/20240402092039_add_answer_options_counter_cache_to_questions.rb +16 -0
  56. data/db/migrate/20240402095253_add_matrix_row_counter_cache_to_questions.rb +16 -0
  57. data/db/migrate/20240416111953_add_display_conditions_counter_cache_to_questions.rb +16 -0
  58. data/db/migrate/20240416113926_add_display_conditions_for_other_questions_counter_cache_to_questions.rb +16 -0
  59. data/decidim-forms.gemspec +1 -1
  60. data/lib/decidim/forms/test/shared_examples/has_questionnaire.rb +44 -44
  61. data/lib/decidim/forms/test/shared_examples/manage_questionnaire_answers.rb +12 -12
  62. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_display_conditions.rb +10 -10
  63. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_questions.rb +85 -85
  64. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_display_conditions.rb +8 -8
  65. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb +82 -82
  66. data/lib/decidim/forms/test/shared_examples/manage_questionnaires.rb +9 -9
  67. data/lib/decidim/forms/version.rb +1 -1
  68. 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).not_to have_select("Maximum number of choices")
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
- click_button "Add answer option"
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
- click_button "Add answer option"
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") { click_button "Remove" }
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") { click_button "Remove" }
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
- click_button "Add question"
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).not_to have_select("Maximum number of choices")
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
- click_button "Add question"
43
- click_button "Add separator"
44
- click_button "Add title and description"
45
- click_button "Add question"
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 have_selector(".questionnaire-question", count: 4)
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
- click_button "Save"
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 have_selector("input[value='This is the first question']")
65
- expect(page).to have_selector("input[value='This is the second question']")
66
- expect(page).to have_selector("input[value='This is the first title and description']")
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
- click_button "Add question"
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
- click_button "Save"
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 have_selector("strong", text: "Superkalifragilistic description")
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
- click_button "Add title and description"
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
- click_button "Save"
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 have_selector("strong", text: "Superkalifragilistic description")
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
- click_button "Add question"
145
- click_button "Add question"
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).not_to have_content "Add answer option"
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
- click_button "Add answer option"
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
- click_button "Save"
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 have_selector("input[value='This is the first question']")
179
- expect(page).to have_selector("input[value='This is the Q1 first option']")
180
- expect(page).to have_selector("input[value='This is the Q1 second option']")
181
- expect(page).to have_selector("input[value='This is the Q1 third option']")
182
- expect(page).to have_selector("input[value='This is the second question']")
183
- expect(page).to have_selector("input[value='This is the Q2 first option']")
184
- expect(page).to have_selector("input[value='This is the Q2 second option']")
185
- expect(page).to have_selector("input[value='This is the Q2 third option']")
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
- click_button "Add question"
189
+ click_on "Add question"
190
190
  expand_all_questions
191
191
 
192
192
  select "Long answer", from: "Type"
193
- expect(page).not_to have_selector(".questionnaire-question-answer-option")
194
- expect(page).not_to have_selector(".questionnaire-question-matrix-row")
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 have_selector(".questionnaire-question-answer-option", count: 2)
198
- expect(page).not_to have_selector(".questionnaire-question-matrix-row")
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 have_selector(".questionnaire-question-answer-option", count: 2)
202
- expect(page).not_to have_selector(".questionnaire-question-matrix-row")
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 have_selector(".questionnaire-question-answer-option", count: 2)
206
- expect(page).to have_selector(".questionnaire-question-matrix-row", count: 2)
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).not_to have_selector(".questionnaire-question-answer-option")
210
- expect(page).not_to have_selector(".questionnaire-question-matrix-row")
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 have_selector(".questionnaire-question-answer-option", count: 2)
214
- expect(page).to have_selector(".questionnaire-question-matrix-row", count: 2)
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
- click_button "Add question"
218
+ click_on "Add question"
219
219
  expand_all_questions
220
220
 
221
221
  select "Single option", from: "Type"
222
- 2.times { click_button "Add answer option" }
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
- click_button "Add question"
248
+ click_on "Add question"
249
249
  expand_all_questions
250
250
 
251
251
  select "Matrix (Multiple option)", from: "Type"
252
- 2.times { click_button "Add row" }
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
- click_button "Add question"
278
+ click_on "Add question"
279
279
  expand_all_questions
280
280
 
281
281
  select "Long answer", from: "Type"
282
- click_button "Save"
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
- click_button "Add question"
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
- click_button "Save"
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
- click_button "Add question"
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
- click_button "Save"
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
- click_button "Add question"
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
- click_button "Add answer option"
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
- click_button "Save"
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
- click_button "Add question"
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
- click_button "Add row"
374
+ click_on "Add row"
375
375
 
376
- click_button "Save"
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
- click_button "Add question"
386
- click_button "Save"
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
- click_link "Català", match: :first
392
+ click_on "Català", match: :first
393
393
 
394
394
  fill_in find_nested_form_field_locator("body_ca"), with: "Adeu"
395
- click_link "English", match: :first
395
+ click_on "English", match: :first
396
396
 
397
397
  expect(page).to have_nested_field("body_en", with: "Bye")
398
- expect(page).not_to have_selector(nested_form_field_selector("body_ca"))
399
- expect(page).not_to have_content("Adeu")
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
- click_button "Add question"
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).not_to have_content "Add answer option"
420
- expect(page).not_to have_select("Maximum number of choices")
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).not_to have_selector("input[type=checkbox][id$=_free_text]")
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 have_selector("input[type=checkbox][id$=_free_text]")
428
+ expect(page).to have_css("input[type=checkbox][id$=_free_text]")
429
429
 
430
430
  select "Short answer", from: "Type"
431
- expect(page).not_to have_selector("input[type=checkbox][id$=_free_text]")
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 have_selector("input[type=checkbox][id$=_free_text]")
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
- click_button "Add question"
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).not_to have_content "Add answer option"
456
- expect(page).not_to have_content "Add row"
457
- expect(page).not_to have_select("Maximum number of choices")
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).not_to have_selector("input[type=checkbox][id$=_free_text]")
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 have_selector("input[type=checkbox][id$=_free_text]")
465
+ expect(page).to have_css("input[type=checkbox][id$=_free_text]")
466
466
 
467
467
  select "Short answer", from: "Type"
468
- expect(page).not_to have_selector("input[type=checkbox][id$=_free_text]")
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 have_selector("input[type=checkbox][id$=_free_text]")
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"
@@ -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 have_selector(".questionnaire-question-display-condition")
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
- click_button "Remove"
57
+ click_on "Remove"
58
58
  end
59
59
 
60
- click_button "Save"
60
+ click_on "Save"
61
61
 
62
62
  visit_questionnaire_edit_path_and_expand_all
63
63
 
64
- expect(page).to have_selector(".questionnaire-question-display-condition", count: 0)
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 have_selector(".questionnaire-question", count: 2)
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
- click_button "Remove", match: :first
78
+ click_on "Remove", match: :first
79
79
  end
80
80
 
81
- click_button "Save"
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 have_selector(".questionnaire-question", count: 1)
89
+ expect(page).to have_css(".questionnaire-question", count: 1)
90
90
  end
91
91
  end
92
92
  end