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
@@ -10,7 +10,7 @@ shared_examples_for "has questionnaire" do
10
10
  expect(page).to have_i18n_content(questionnaire.title)
11
11
  expect(page).to have_i18n_content(questionnaire.description, strip_tags: true)
12
12
 
13
- expect(page).not_to have_css(".form.answer-questionnaire")
13
+ expect(page).to have_no_css(".form.answer-questionnaire")
14
14
 
15
15
  within "[data-question-readonly]" do
16
16
  expect(page).to have_i18n_content(question.body)
@@ -46,7 +46,7 @@ shared_examples_for "has questionnaire" do
46
46
  check "questionnaire_tos_agreement"
47
47
 
48
48
  accept_confirm do
49
- click_button "Submit"
49
+ click_on "Submit"
50
50
  end
51
51
 
52
52
  expect(page).to have_admin_callout(callout_success)
@@ -69,18 +69,18 @@ shared_examples_for "has questionnaire" do
69
69
  expect(page).to have_content("Step 1 of 2")
70
70
 
71
71
  within ".answer-questionnaire__submit", match: :first do
72
- expect(page).not_to have_content("Back")
72
+ expect(page).to have_no_content("Back")
73
73
  end
74
74
 
75
75
  answer_first_questionnaire
76
76
 
77
- expect(page).not_to have_selector(".success.flash")
77
+ expect(page).to have_no_css(".success.flash")
78
78
  end
79
79
 
80
80
  it "allows revisiting previously-answered questionnaires with my answers" do
81
81
  answer_first_questionnaire
82
82
 
83
- click_button "Back"
83
+ click_on "Back"
84
84
 
85
85
  expect(page).to have_content("Step 1 of 2")
86
86
  expect(page).to have_field("questionnaire_responses_0", with: "My first answer")
@@ -90,7 +90,7 @@ shared_examples_for "has questionnaire" do
90
90
  answer_first_questionnaire
91
91
 
92
92
  check "questionnaire_tos_agreement"
93
- accept_confirm { click_button "Submit" }
93
+ accept_confirm { click_on "Submit" }
94
94
 
95
95
  expect(page).to have_admin_callout(callout_success)
96
96
 
@@ -101,10 +101,10 @@ shared_examples_for "has questionnaire" do
101
101
 
102
102
  def answer_first_questionnaire
103
103
  within "#step-0" do
104
- expect(page).not_to have_selector("#questionnaire_tos_agreement")
104
+ expect(page).to have_no_css("#questionnaire_tos_agreement")
105
105
 
106
106
  fill_in question.body["en"], with: "My first answer"
107
- click_button "Continue"
107
+ click_on "Continue"
108
108
  end
109
109
  expect(page).to have_content("Step 2 of 2")
110
110
  end
@@ -148,7 +148,7 @@ shared_examples_for "has questionnaire" do
148
148
  it "does not leak defaults from other answers" do
149
149
  visit questionnaire_public_path
150
150
 
151
- expect(page).not_to have_field(type: "radio", checked: true)
151
+ expect(page).to have_no_field(type: "radio", checked: true)
152
152
  end
153
153
  end
154
154
 
@@ -179,7 +179,7 @@ shared_examples_for "has questionnaire" do
179
179
 
180
180
  before do
181
181
  visit questionnaire_public_path
182
- accept_confirm { click_button "Submit" }
182
+ accept_confirm { click_on "Submit" }
183
183
  end
184
184
 
185
185
  it_behaves_like "a correctly ordered questionnaire"
@@ -220,7 +220,7 @@ shared_examples_for "has questionnaire" do
220
220
  it "does not show message indicating number of characters left" do
221
221
  visit questionnaire_public_path
222
222
 
223
- expect(page).not_to have_content("characters left")
223
+ expect(page).to have_no_content("characters left")
224
224
  end
225
225
  end
226
226
  end
@@ -229,7 +229,7 @@ shared_examples_for "has questionnaire" do
229
229
  include_context "when a non multiple choice question is mandatory"
230
230
 
231
231
  before do
232
- click_button "Submit"
232
+ click_on "Submit"
233
233
  end
234
234
 
235
235
  it "submits the form and shows errors" do
@@ -242,14 +242,14 @@ shared_examples_for "has questionnaire" do
242
242
  include_context "when a non multiple choice question is mandatory"
243
243
 
244
244
  before do
245
- accept_confirm { click_button "Submit" }
245
+ accept_confirm { click_on "Submit" }
246
246
  end
247
247
 
248
248
  it "shows errors without submitting the form" do
249
- expect(page).not_to have_selector ".alert.flash"
249
+ expect(page).to have_no_css ".alert.flash"
250
250
  different_error = I18n.t("decidim.forms.questionnaires.answer.max_choices_alert")
251
251
  expect(different_error).to eq("There are too many choices selected")
252
- expect(page).not_to have_content(different_error)
252
+ expect(page).to have_no_content(different_error)
253
253
 
254
254
  expect(page).to have_content("cannot be blank")
255
255
  end
@@ -275,7 +275,7 @@ shared_examples_for "has questionnaire" do
275
275
 
276
276
  check "questionnaire_tos_agreement"
277
277
 
278
- accept_confirm { click_button "Submit" }
278
+ accept_confirm { click_on "Submit" }
279
279
  end
280
280
 
281
281
  it "submits the form and shows errors" do
@@ -290,7 +290,7 @@ shared_examples_for "has questionnaire" do
290
290
  it "properly interprets HTML descriptions" do
291
291
  visit questionnaire_public_path
292
292
 
293
- expect(page).to have_selector("b", text: "This question is important")
293
+ expect(page).to have_css("b", text: "This question is important")
294
294
  end
295
295
  end
296
296
 
@@ -335,7 +335,7 @@ shared_examples_for "has questionnaire" do
335
335
  let(:question_type) { "single_option" }
336
336
 
337
337
  it "renders them as radio buttons with attached text fields disabled by default" do
338
- expect(page).to have_selector(".js-radio-button-collection input[type=radio]", count: 3)
338
+ expect(page).to have_css(".js-radio-button-collection input[type=radio]", count: 3)
339
339
 
340
340
  expect(page).to have_field("questionnaire_responses_0_choices_2_custom_body", disabled: true, count: 1)
341
341
 
@@ -349,7 +349,7 @@ shared_examples_for "has questionnaire" do
349
349
  fill_in "questionnaire_responses_0_choices_2_custom_body", with: "Cacatua"
350
350
 
351
351
  check "questionnaire_tos_agreement"
352
- accept_confirm { click_button "Submit" }
352
+ accept_confirm { click_on "Submit" }
353
353
 
354
354
  expect(page).to have_admin_callout(callout_success)
355
355
  expect(Decidim::Forms::Answer.first.choices.first.custom_body).to eq("Cacatua")
@@ -364,7 +364,7 @@ shared_examples_for "has questionnaire" do
364
364
  fill_in "questionnaire_responses_0_choices_2_custom_body", with: "Cacatua"
365
365
 
366
366
  check "questionnaire_tos_agreement"
367
- accept_confirm { click_button "Submit" }
367
+ accept_confirm { click_on "Submit" }
368
368
 
369
369
  expect(page).to have_admin_callout("There was a problem answering")
370
370
  expect(page).to have_field("questionnaire_responses_0_choices_2_custom_body", with: "Cacatua")
@@ -391,7 +391,7 @@ shared_examples_for "has questionnaire" do
391
391
  fill_in "questionnaire_responses_0_choices_2_custom_body", with: "Cacatua"
392
392
 
393
393
  check "questionnaire_tos_agreement"
394
- accept_confirm { click_button "Submit" }
394
+ accept_confirm { click_on "Submit" }
395
395
 
396
396
  expect(page).to have_admin_callout(callout_success)
397
397
  expect(Decidim::Forms::Answer.first.choices.first.custom_body).to eq("Cacatua")
@@ -406,7 +406,7 @@ shared_examples_for "has questionnaire" do
406
406
  fill_in "questionnaire_responses_0_choices_2_custom_body", with: "Cacatua"
407
407
 
408
408
  check "questionnaire_tos_agreement"
409
- accept_confirm { click_button "Submit" }
409
+ accept_confirm { click_on "Submit" }
410
410
 
411
411
  expect(page).to have_admin_callout("There was a problem answering")
412
412
  expect(page).to have_field("questionnaire_responses_0_choices_2_custom_body", with: "Cacatua")
@@ -423,7 +423,7 @@ shared_examples_for "has questionnaire" do
423
423
  it "renders the answer as a textarea" do
424
424
  visit questionnaire_public_path
425
425
 
426
- expect(page).to have_selector("textarea#questionnaire_responses_0")
426
+ expect(page).to have_css("textarea#questionnaire_responses_0")
427
427
  end
428
428
 
429
429
  it_behaves_like "question has a character limit"
@@ -449,13 +449,13 @@ shared_examples_for "has questionnaire" do
449
449
  it "renders answers as a collection of radio buttons" do
450
450
  visit questionnaire_public_path
451
451
 
452
- expect(page).to have_selector(".js-radio-button-collection input[type=radio]", count: 2)
452
+ expect(page).to have_css(".js-radio-button-collection input[type=radio]", count: 2)
453
453
 
454
454
  choose answer_options[0]["body"][:en]
455
455
 
456
456
  check "questionnaire_tos_agreement"
457
457
 
458
- accept_confirm { click_button "Submit" }
458
+ accept_confirm { click_on "Submit" }
459
459
 
460
460
  expect(page).to have_admin_callout(callout_success)
461
461
 
@@ -473,16 +473,16 @@ shared_examples_for "has questionnaire" do
473
473
  it "renders answers as a collection of radio buttons" do
474
474
  visit questionnaire_public_path
475
475
 
476
- expect(page).to have_selector(".js-check-box-collection input[type=checkbox]", count: 3)
476
+ expect(page).to have_css(".js-check-box-collection input[type=checkbox]", count: 3)
477
477
 
478
- expect(page).not_to have_content("Max choices:")
478
+ expect(page).to have_no_content("Max choices:")
479
479
 
480
480
  check answer_options[0]["body"][:en]
481
481
  check answer_options[1]["body"][:en]
482
482
 
483
483
  check "questionnaire_tos_agreement"
484
484
 
485
- accept_confirm { click_button "Submit" }
485
+ accept_confirm { click_on "Submit" }
486
486
 
487
487
  expect(page).to have_admin_callout(callout_success)
488
488
 
@@ -507,14 +507,14 @@ shared_examples_for "has questionnaire" do
507
507
 
508
508
  check "questionnaire_tos_agreement"
509
509
 
510
- accept_confirm { click_button "Submit" }
510
+ accept_confirm { click_on "Submit" }
511
511
 
512
512
  expect(page).to have_admin_callout("There was a problem answering")
513
513
  expect(page).to have_content("are too many")
514
514
 
515
515
  uncheck answer_options[2]["body"][:en]
516
516
 
517
- accept_confirm { click_button "Submit" }
517
+ accept_confirm { click_on "Submit" }
518
518
 
519
519
  expect(page).to have_admin_callout(callout_success)
520
520
  end
@@ -539,7 +539,7 @@ shared_examples_for "has questionnaire" do
539
539
  it "renders the question answers as a collection of divs sortable on drag and drop" do
540
540
  visit questionnaire_public_path
541
541
 
542
- expect(page).to have_selector("div.answer-questionnaire__sorting.js-collection-input", count: 5)
542
+ expect(page).to have_css("div.answer-questionnaire__sorting.js-collection-input", count: 5)
543
543
 
544
544
  %w(We all like dark chocolate).each do |term|
545
545
  expect(page).to have_content(term)
@@ -555,7 +555,7 @@ shared_examples_for "has questionnaire" do
555
555
 
556
556
  check "questionnaire_tos_agreement"
557
557
 
558
- accept_confirm { click_button "Submit" }
558
+ accept_confirm { click_on "Submit" }
559
559
 
560
560
  expect(page).to have_admin_callout(callout_success)
561
561
  expect(Decidim::Forms::Answer.first.choices.pluck(:position, :body)).to eq(
@@ -583,7 +583,7 @@ shared_examples_for "has questionnaire" do
583
583
  it "renders the question answers as a collection of radio buttons" do
584
584
  visit questionnaire_public_path
585
585
 
586
- expect(page).to have_selector(".js-radio-button-collection input[type=radio]", count: 4)
586
+ expect(page).to have_css(".js-radio-button-collection input[type=radio]", count: 4)
587
587
 
588
588
  expect(page).to have_content(matrix_rows.map { |row| row["body"]["en"] }.join("\n"))
589
589
  expect(page).to have_content(answer_options.map { |option| option["body"]["en"] }.join(" "))
@@ -595,7 +595,7 @@ shared_examples_for "has questionnaire" do
595
595
 
596
596
  check "questionnaire_tos_agreement"
597
597
 
598
- accept_confirm { click_button "Submit" }
598
+ accept_confirm { click_on "Submit" }
599
599
 
600
600
  expect(page).to have_admin_callout(callout_success)
601
601
 
@@ -616,7 +616,7 @@ shared_examples_for "has questionnaire" do
616
616
  radio_buttons = page.all(".js-radio-button-collection input[type=radio]")
617
617
  choose radio_buttons[1][:id]
618
618
 
619
- accept_confirm { click_button "Submit" }
619
+ accept_confirm { click_on "Submit" }
620
620
 
621
621
  expect(page).to have_admin_callout("There was a problem answering")
622
622
 
@@ -634,7 +634,7 @@ shared_examples_for "has questionnaire" do
634
634
  choose radio_buttons[0][:id]
635
635
 
636
636
  check "questionnaire_tos_agreement"
637
- accept_confirm { click_button "Submit" }
637
+ accept_confirm { click_on "Submit" }
638
638
 
639
639
  expect(page).to have_admin_callout("There was a problem answering")
640
640
  expect(page).to have_content("Choices are not complete")
@@ -663,7 +663,7 @@ shared_examples_for "has questionnaire" do
663
663
  it "renders the question answers as a collection of check boxes" do
664
664
  visit questionnaire_public_path
665
665
 
666
- expect(page).to have_selector(".js-check-box-collection input[type=checkbox]", count: 6)
666
+ expect(page).to have_css(".js-check-box-collection input[type=checkbox]", count: 6)
667
667
 
668
668
  expect(page).to have_content(matrix_rows.map { |row| row["body"]["en"] }.join("\n"))
669
669
  expect(page).to have_content(answer_options.map { |option| option["body"]["en"] }.join(" "))
@@ -676,7 +676,7 @@ shared_examples_for "has questionnaire" do
676
676
 
677
677
  check "questionnaire_tos_agreement"
678
678
 
679
- accept_confirm { click_button "Submit" }
679
+ accept_confirm { click_on "Submit" }
680
680
 
681
681
  expect(page).to have_admin_callout(callout_success)
682
682
 
@@ -692,7 +692,7 @@ shared_examples_for "has questionnaire" do
692
692
  expect(third_choice).to eq([question.answer_options.first.id, question.matrix_rows.last.id])
693
693
  end
694
694
 
695
- context "when the question hax max_choices defined" do
695
+ context "when the question has max_choices defined" do
696
696
  let!(:max_choices) { 2 }
697
697
 
698
698
  it "respects the max number of choices" do
@@ -721,7 +721,7 @@ shared_examples_for "has questionnaire" do
721
721
 
722
722
  check "questionnaire_tos_agreement"
723
723
 
724
- accept_confirm { click_button "Submit" }
724
+ accept_confirm { click_on "Submit" }
725
725
 
726
726
  expect(page).to have_admin_callout("There was a problem answering")
727
727
  expect(page).to have_content("are too many")
@@ -730,7 +730,7 @@ shared_examples_for "has questionnaire" do
730
730
 
731
731
  uncheck checkboxes[5][:id]
732
732
 
733
- accept_confirm { click_button "Submit" }
733
+ accept_confirm { click_on "Submit" }
734
734
 
735
735
  expect(page).to have_admin_callout(callout_success)
736
736
  end
@@ -746,7 +746,7 @@ shared_examples_for "has questionnaire" do
746
746
  check checkboxes[0][:id]
747
747
 
748
748
  check "questionnaire_tos_agreement"
749
- accept_confirm { click_button "Submit" }
749
+ accept_confirm { click_on "Submit" }
750
750
 
751
751
  expect(page).to have_admin_callout("There was a problem answering")
752
752
  expect(page).to have_content("Choices are not complete")
@@ -766,7 +766,7 @@ shared_examples_for "has questionnaire" do
766
766
  check checkboxes[5][:id]
767
767
 
768
768
  check "questionnaire_tos_agreement"
769
- accept_confirm { click_button "Submit" }
769
+ accept_confirm { click_on "Submit" }
770
770
 
771
771
  expect(page).to have_admin_callout("There was a problem answering")
772
772
 
@@ -1306,7 +1306,7 @@ shared_examples_for "has questionnaire" do
1306
1306
 
1307
1307
  check "questionnaire_tos_agreement"
1308
1308
 
1309
- accept_confirm { click_button "Submit" }
1309
+ accept_confirm { click_on "Submit" }
1310
1310
 
1311
1311
  expect(page).to have_admin_callout(callout_success)
1312
1312
  end
@@ -38,10 +38,10 @@ shared_examples_for "manage questionnaire answers" do
38
38
  context "and managing answers page" do
39
39
  before do
40
40
  visit questionnaire_edit_path
41
- click_link "Show responses"
41
+ click_on "Show responses"
42
42
  end
43
43
 
44
- it "shows the anwers page" do
44
+ it "shows the answers page" do
45
45
  expect(page).to have_content(answer1.body)
46
46
  expect(page).to have_content(answer1.question.body["en"])
47
47
  expect(page).to have_content(answer2.body)
@@ -66,7 +66,7 @@ shared_examples_for "manage questionnaire answers" do
66
66
  let(:first_type) { "long_answer" }
67
67
 
68
68
  it "shows session token" do
69
- expect(page).not_to have_content(answer1.body)
69
+ expect(page).to have_no_content(answer1.body)
70
70
  expect(page).to have_content(answer1.session_token)
71
71
  expect(page).to have_content(answer2.session_token)
72
72
  expect(page).to have_content(answer3.session_token)
@@ -98,36 +98,36 @@ shared_examples_for "manage questionnaire answers" do
98
98
 
99
99
  before do
100
100
  visit questionnaire_edit_path
101
- click_link "Show responses"
101
+ click_on "Show responses"
102
102
  end
103
103
 
104
104
  it "shows all the questions and responses" do
105
- click_link answer1.body, match: :first
105
+ click_on answer1.body, match: :first
106
106
  expect(page).to have_content(first.body["en"])
107
107
  expect(page).to have_content(second.body["en"])
108
108
  expect(page).to have_content(answer1.body)
109
109
  end
110
110
 
111
111
  it "first answer has a next link" do
112
- click_link answer1.body, match: :first
112
+ click_on answer1.body, match: :first
113
113
  expect(page).to have_link("Next ›")
114
- expect(page).not_to have_link("‹ Prev")
114
+ expect(page).to have_no_link("‹ Prev")
115
115
  end
116
116
 
117
117
  it "second answer has prev/next links" do
118
- click_link answer2.body, match: :first
118
+ click_on answer2.body, match: :first
119
119
  expect(page).to have_link("Next ›")
120
120
  expect(page).to have_link("‹ Prev")
121
121
  end
122
122
 
123
123
  it "third answer has prev link" do
124
- click_link answer3.session_token, match: :first
125
- expect(page).not_to have_link("Next ›")
124
+ click_on answer3.session_token, match: :first
125
+ expect(page).to have_no_link("Next ›")
126
126
  expect(page).to have_link("‹ Prev")
127
127
  end
128
128
 
129
129
  it "third answer has download link for the attachments" do
130
- click_link answer3.session_token, match: :first
130
+ click_on answer3.session_token, match: :first
131
131
  expect(page).to have_content(translated(file_answer.attachments.first.title))
132
132
  expect(page).to have_content(translated(file_answer.attachments.second.title))
133
133
  end
@@ -140,7 +140,7 @@ shared_examples_for "manage questionnaire answers" do
140
140
  end
141
141
 
142
142
  it "third answer has download link for the attachments" do
143
- click_link answer3.session_token, match: :first
143
+ click_on answer3.session_token, match: :first
144
144
  expect(page).to have_content("Download attachment")
145
145
  end
146
146
  end
@@ -21,13 +21,13 @@ shared_examples_for "add display conditions" do
21
21
  end
22
22
 
23
23
  it "does not display an add display condition button" do
24
- expect(page).not_to have_button("Add display condition")
24
+ expect(page).to have_no_button("Add display condition")
25
25
  end
26
26
 
27
27
  context "when creating a new question" do
28
28
  it "disables the add display condition button if the question has not been saved" do
29
29
  within "form.edit_questionnaire" do
30
- click_button "Add question"
30
+ click_on "Add question"
31
31
  expand_all_questions
32
32
 
33
33
  expect(page).to have_button("Add display condition", disabled: true)
@@ -80,19 +80,19 @@ shared_examples_for "add display conditions" do
80
80
  within_add_display_condition do
81
81
  expect(page).to have_select("Question")
82
82
  expect(page).to have_select("Condition")
83
- expect(page).to have_selector("[id$=mandatory]")
83
+ expect(page).to have_css("[id$=mandatory]")
84
84
 
85
85
  select question_single_option.body["en"], from: "Question"
86
86
  select "Answered", from: "Condition"
87
87
 
88
- expect(page).not_to have_select("Answer option")
89
- expect(page).not_to have_css("[id$=condition_value_en]", visible: :visible)
88
+ expect(page).to have_no_select("Answer option")
89
+ expect(page).to have_no_css("[id$=condition_value_en]", visible: :visible)
90
90
 
91
91
  select question_single_option.body["en"], from: "Question"
92
92
  select "Equal", from: "Condition"
93
93
 
94
94
  expect(page).to have_select("Answer option")
95
- expect(page).not_to have_css("[id$=condition_value_en]", visible: :visible)
95
+ expect(page).to have_no_css("[id$=condition_value_en]", visible: :visible)
96
96
  end
97
97
  end
98
98
  end
@@ -163,17 +163,17 @@ shared_examples_for "add display conditions" do
163
163
 
164
164
  it "loads a mandatory field with false value" do
165
165
  within_add_display_condition do
166
- expect(page).to have_selector("[id$=mandatory]")
167
- expect(page).not_to have_selector("[id$=mandatory][checked]")
166
+ expect(page).to have_css("[id$=mandatory]")
167
+ expect(page).to have_no_css("[id$=mandatory][checked]")
168
168
  end
169
169
  end
170
170
 
171
171
  it "can be removed" do
172
172
  within_add_display_condition do
173
- click_button "Remove"
173
+ click_on "Remove"
174
174
  end
175
175
 
176
- click_button "Save"
176
+ click_on "Save"
177
177
 
178
178
  expect(page).to have_admin_callout("successfully")
179
179
  end