decidim-forms 0.28.6 → 0.29.0.rc1

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.
Files changed (79) 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/admin/questionnaire_form.rb +2 -2
  8. data/app/forms/decidim/forms/answer_form.rb +2 -2
  9. data/app/forms/decidim/forms/questionnaire_form.rb +1 -1
  10. data/app/helpers/decidim/forms/application_helper.rb +2 -2
  11. data/app/models/decidim/forms/answer_choice.rb +0 -2
  12. data/app/models/decidim/forms/answer_option.rb +1 -1
  13. data/app/models/decidim/forms/display_condition.rb +11 -3
  14. data/app/models/decidim/forms/question_matrix_row.rb +1 -1
  15. data/app/presenters/decidim/forms/admin/questionnaire_participant_presenter.rb +7 -7
  16. data/app/views/decidim/forms/admin/questionnaires/_answer_option.html.erb +1 -1
  17. data/app/views/decidim/forms/admin/questionnaires/_display_condition.html.erb +2 -2
  18. data/app/views/decidim/forms/admin/questionnaires/_matrix_row.html.erb +1 -1
  19. data/app/views/decidim/forms/admin/questionnaires/_question.html.erb +4 -4
  20. data/app/views/decidim/forms/admin/questionnaires/_separator.html.erb +4 -4
  21. data/app/views/decidim/forms/admin/questionnaires/_title_and_description.html.erb +4 -4
  22. data/app/views/decidim/forms/questionnaires/_answer.html.erb +1 -11
  23. data/config/initializers/wicked_pdf.rb +6 -4
  24. data/config/locales/ar.yml +10 -2
  25. data/config/locales/bg.yml +38 -2
  26. data/config/locales/ca.yml +11 -11
  27. data/config/locales/cs.yml +14 -4
  28. data/config/locales/de.yml +11 -11
  29. data/config/locales/el.yml +37 -2
  30. data/config/locales/en.yml +2 -2
  31. data/config/locales/es-MX.yml +14 -14
  32. data/config/locales/es-PY.yml +14 -14
  33. data/config/locales/es.yml +13 -13
  34. data/config/locales/eu.yml +14 -14
  35. data/config/locales/fi-plain.yml +9 -9
  36. data/config/locales/fi.yml +10 -10
  37. data/config/locales/fr-CA.yml +11 -11
  38. data/config/locales/fr.yml +11 -11
  39. data/config/locales/ga-IE.yml +5 -0
  40. data/config/locales/gl.yml +5 -2
  41. data/config/locales/hu.yml +11 -5
  42. data/config/locales/id-ID.yml +4 -2
  43. data/config/locales/it.yml +24 -2
  44. data/config/locales/ja.yml +7 -7
  45. data/config/locales/lb.yml +27 -2
  46. data/config/locales/lt.yml +37 -2
  47. data/config/locales/lv.yml +9 -2
  48. data/config/locales/nl.yml +23 -1
  49. data/config/locales/no.yml +27 -1
  50. data/config/locales/pl.yml +38 -1
  51. data/config/locales/pt-BR.yml +29 -1
  52. data/config/locales/pt.yml +26 -1
  53. data/config/locales/ro-RO.yml +41 -16
  54. data/config/locales/ru.yml +1 -2
  55. data/config/locales/sk.yml +7 -2
  56. data/config/locales/sl.yml +7 -0
  57. data/config/locales/sv.yml +52 -33
  58. data/config/locales/tr-TR.yml +22 -1
  59. data/config/locales/val-ES.yml +2 -0
  60. data/config/locales/zh-CN.yml +22 -1
  61. data/config/locales/zh-TW.yml +37 -2
  62. data/db/migrate/20240402092039_add_answer_options_counter_cache_to_questions.rb +16 -0
  63. data/db/migrate/20240402095253_add_matrix_row_counter_cache_to_questions.rb +16 -0
  64. data/db/migrate/20240416111953_add_display_conditions_counter_cache_to_questions.rb +16 -0
  65. data/db/migrate/20240416113926_add_display_conditions_for_other_questions_counter_cache_to_questions.rb +16 -0
  66. data/decidim-forms.gemspec +3 -2
  67. data/lib/decidim/forms/test/shared_examples/has_questionnaire.rb +44 -70
  68. data/lib/decidim/forms/test/shared_examples/manage_questionnaire_answers.rb +12 -12
  69. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_display_conditions.rb +10 -10
  70. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_questions.rb +85 -85
  71. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_display_conditions.rb +8 -8
  72. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb +82 -82
  73. data/lib/decidim/forms/test/shared_examples/manage_questionnaires.rb +9 -9
  74. data/lib/decidim/forms/user_answers_serializer.rb +1 -1
  75. data/lib/decidim/forms/version.rb +1 -1
  76. metadata +31 -16
  77. data/config/locales/bn-BD.yml +0 -1
  78. data/config/locales/bs-BA.yml +0 -1
  79. data/config/locales/ca-IT.yml +0 -198
@@ -4,6 +4,8 @@ zh-TW:
4
4
  attributes:
5
5
  answer:
6
6
  body: 回答
7
+ choices: 選項
8
+ selected_choices: 已選擇的選項
7
9
  question:
8
10
  max_choices: 選擇的最大數量
9
11
  question_type: 類別
@@ -14,8 +16,12 @@ zh-TW:
14
16
  models:
15
17
  answer:
16
18
  attributes:
19
+ add_documents:
20
+ needs_to_be_reattached: 需要重新附加
21
+ body:
22
+ too_long: 太長
17
23
  choices:
18
- too_many: 太多了
24
+ missing: 尚未完成
19
25
  questionnaire:
20
26
  request_invalid: 處理請求時發生錯誤。請再試一次。
21
27
  decidim:
@@ -31,14 +37,24 @@ zh-TW:
31
37
  show: 顯示回應
32
38
  answer_option:
33
39
  answer_option: 答案選項:
40
+ free_text: 免費文字
34
41
  remove: 移除
35
42
  statement: 聲明
36
43
  answers:
37
44
  actions:
45
+ back: 返回回覆
46
+ export: 匯出
47
+ next: 下一個 ›
48
+ previous: "‹ 上一篇"
38
49
  show: 顯示答案
39
50
  empty: 目前尚未回答
51
+ export:
52
+ answer:
53
+ title: '回應 #%{number}'
40
54
  export_response:
41
55
  title: 調查問卷使用者回答_%{token}
56
+ index:
57
+ title: "%{total} 個回應總數"
42
58
  show:
43
59
  title: '回答#%{number}'
44
60
  display_condition:
@@ -64,10 +80,14 @@ zh-TW:
64
80
  title: 編輯問卷內容
65
81
  form:
66
82
  add_question: 新增問題
83
+ add_separator: 新增分隔線
84
+ add_title_and_description: 新增標題與描述
85
+ already_answered_warning: 已有使用者回答此表單,因此您無法修改問題。
67
86
  collapse: 收起所有問題
68
87
  expand: 展開所有問題
69
88
  preview: 預覽
70
89
  title: 編輯問卷表單%{questionnaire_for}
90
+ unpublished_warning: 此表單尚未發佈。您可以修改其問題,但這樣做將刪除目前的回答。
71
91
  matrix_row:
72
92
  matrix_row: 列
73
93
  remove: 移除
@@ -106,6 +126,9 @@ zh-TW:
106
126
  admin_log:
107
127
  questionnaire:
108
128
  update: "%{user_name} 更新了 %{resource_name} 問卷模板"
129
+ errors:
130
+ answer:
131
+ body: 內容不能為空
109
132
  images:
110
133
  dimensions: "%{width} x %{height} 像素"
111
134
  processors:
@@ -121,15 +144,20 @@ zh-TW:
121
144
  single_option: 單選
122
145
  sorting: 排序中
123
146
  title_and_description: 標題和描述
147
+ questionnaire_answer_presenter:
148
+ download_attachment: 下載附件
124
149
  questionnaires:
125
150
  answer:
126
151
  invalid: 回答表單時出現問題
152
+ max_choices_alert: 選擇的項目太多了
127
153
  success: 表單已成功回答
128
154
  question:
129
155
  max_choices: '最多選擇數量: %{n}'
130
156
  show:
131
157
  answer_questionnaire:
132
- sign_in_description: 登入以填寫問卷
158
+ already_have_an_account?: 已經有帳號了嗎?
159
+ are_you_new?: 新用戶?
160
+ sign_up_description: 建立參與者帳號以填寫問卷
133
161
  title: 回答表單
134
162
  current_step: 步驟%{step}
135
163
  of_total_steps: 的%{total_steps}
@@ -150,11 +178,18 @@ zh-TW:
150
178
  tos_agreement: 透過參與,您同意其服務條款
151
179
  step_navigation:
152
180
  show:
181
+ are_you_sure: 此操作無法撤消,您將無法編輯您的答案。您確定嗎?
153
182
  back: 返回
154
183
  continue: 繼續
155
184
  submit: 提交
156
185
  user_answers_serializer:
157
186
  body: 回答
187
+ completion: 完成
158
188
  created_at: 回答時間
159
189
  id: 回答 ID
190
+ ip_hash: IP Hash
160
191
  question: 問題
192
+ registered: 已註冊
193
+ session_token: 使用者識別碼
194
+ unregistered: 未註冊
195
+ user_status: 用戶狀態
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddAnswerOptionsCounterCacheToQuestions < ActiveRecord::Migration[6.1]
4
+ def change
5
+ add_column :decidim_forms_questions, :answer_options_count, :integer, null: false, default: 0
6
+
7
+ reversible do |dir|
8
+ dir.up do
9
+ Decidim::Forms::Question.reset_column_information
10
+ Decidim::Forms::Question.find_each do |record|
11
+ record.class.reset_counters(record.id, :answer_options)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddMatrixRowCounterCacheToQuestions < ActiveRecord::Migration[6.1]
4
+ def change
5
+ add_column :decidim_forms_questions, :matrix_rows_count, :integer, null: false, default: 0
6
+
7
+ reversible do |dir|
8
+ dir.up do
9
+ Decidim::Forms::Question.reset_column_information
10
+ Decidim::Forms::Question.find_each do |record|
11
+ record.class.reset_counters(record.id, :matrix_rows)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddDisplayConditionsCounterCacheToQuestions < ActiveRecord::Migration[6.1]
4
+ def change
5
+ add_column :decidim_forms_questions, :display_conditions_count, :integer, null: false, default: 0
6
+
7
+ reversible do |dir|
8
+ dir.up do
9
+ Decidim::Forms::Question.reset_column_information
10
+ Decidim::Forms::Question.find_each do |record|
11
+ record.class.reset_counters(record.id, :display_conditions)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddDisplayConditionsForOtherQuestionsCounterCacheToQuestions < ActiveRecord::Migration[6.1]
4
+ def change
5
+ add_column :decidim_forms_questions, :display_conditions_for_other_questions_count, :integer, null: false, default: 0
6
+
7
+ reversible do |dir|
8
+ dir.up do
9
+ Decidim::Forms::Question.reset_column_information
10
+ Decidim::Forms::Question.find_each do |record|
11
+ record.class.reset_counters(record.id, :display_conditions_for_other_questions)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.version = Decidim::Forms.version
11
11
  s.authors = ["Josep Jaume Rey Peroy", "Marc Riera Casals", "Oriol Gual Oliva", "Rubén González Valero"]
12
12
  s.email = ["josepjaume@gmail.com", "mrc2407@gmail.com", "oriolgual@gmail.com", "rbngzlv@gmail.com"]
13
- s.license = "AGPL-3.0-or-later"
13
+ s.license = "AGPL-3.0"
14
14
  s.homepage = "https://decidim.org"
15
15
  s.metadata = {
16
16
  "bug_tracker_uri" => "https://github.com/decidim/decidim/issues",
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  "homepage_uri" => "https://decidim.org",
20
20
  "source_code_uri" => "https://github.com/decidim/decidim"
21
21
  }
22
- s.required_ruby_version = "~> 3.1.0"
22
+ s.required_ruby_version = "~> 3.2.0"
23
23
 
24
24
  s.name = "decidim-forms"
25
25
  s.summary = "Decidim forms"
@@ -34,6 +34,7 @@ Gem::Specification.new do |s|
34
34
 
35
35
  s.add_dependency "decidim-core", Decidim::Forms.version
36
36
  s.add_dependency "wicked_pdf", "~> 2.1"
37
+ s.add_dependency "wkhtmltopdf-binary", "~> 0.12"
37
38
 
38
39
  s.add_development_dependency "decidim-admin", Decidim::Forms.version
39
40
  s.add_development_dependency "decidim-dev", Decidim::Forms.version
@@ -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)
@@ -57,32 +57,6 @@ shared_examples_for "has questionnaire" do
57
57
  expect(page).to have_no_i18n_content(question.body)
58
58
  end
59
59
 
60
- context "and there is a mandatory question" do
61
- let!(:question) do
62
- create(
63
- :questionnaire_question,
64
- questionnaire:,
65
- question_type: "short_answer",
66
- position: 0,
67
- mandatory: true
68
- )
69
- end
70
-
71
- before do
72
- visit questionnaire_public_path
73
- end
74
-
75
- it "it renders the asterisk as a separated element" do
76
- within "label.answer-questionnaire__question-label" do
77
- expect(page).to have_content(translated_attribute(question.body).to_s)
78
- within "span.label-required.has-tip" do
79
- expect(page).to have_content("*")
80
- expect(page).to have_content("Required field")
81
- end
82
- end
83
- end
84
- end
85
-
86
60
  context "with multiple steps" do
87
61
  let!(:separator) { create(:questionnaire_question, questionnaire:, position: 1, question_type: :separator) }
88
62
  let!(:question2) { create(:questionnaire_question, questionnaire:, position: 2) }
@@ -95,18 +69,18 @@ shared_examples_for "has questionnaire" do
95
69
  expect(page).to have_content("Step 1 of 2")
96
70
 
97
71
  within ".answer-questionnaire__submit", match: :first do
98
- expect(page).not_to have_content("Back")
72
+ expect(page).to have_no_content("Back")
99
73
  end
100
74
 
101
75
  answer_first_questionnaire
102
76
 
103
- expect(page).not_to have_selector(".success.flash")
77
+ expect(page).to have_no_css(".success.flash")
104
78
  end
105
79
 
106
80
  it "allows revisiting previously-answered questionnaires with my answers" do
107
81
  answer_first_questionnaire
108
82
 
109
- click_button "Back"
83
+ click_on "Back"
110
84
 
111
85
  expect(page).to have_content("Step 1 of 2")
112
86
  expect(page).to have_field("questionnaire_responses_0", with: "My first answer")
@@ -116,7 +90,7 @@ shared_examples_for "has questionnaire" do
116
90
  answer_first_questionnaire
117
91
 
118
92
  check "questionnaire_tos_agreement"
119
- accept_confirm { click_button "Submit" }
93
+ accept_confirm { click_on "Submit" }
120
94
 
121
95
  expect(page).to have_admin_callout(callout_success)
122
96
 
@@ -127,10 +101,10 @@ shared_examples_for "has questionnaire" do
127
101
 
128
102
  def answer_first_questionnaire
129
103
  within "#step-0" do
130
- expect(page).not_to have_selector("#questionnaire_tos_agreement")
104
+ expect(page).to have_no_css("#questionnaire_tos_agreement")
131
105
 
132
106
  fill_in question.body["en"], with: "My first answer"
133
- click_button "Continue"
107
+ click_on "Continue"
134
108
  end
135
109
  expect(page).to have_content("Step 2 of 2")
136
110
  end
@@ -174,7 +148,7 @@ shared_examples_for "has questionnaire" do
174
148
  it "does not leak defaults from other answers" do
175
149
  visit questionnaire_public_path
176
150
 
177
- expect(page).not_to have_field(type: "radio", checked: true)
151
+ expect(page).to have_no_field(type: "radio", checked: true)
178
152
  end
179
153
  end
180
154
 
@@ -205,7 +179,7 @@ shared_examples_for "has questionnaire" do
205
179
 
206
180
  before do
207
181
  visit questionnaire_public_path
208
- accept_confirm { click_button "Submit" }
182
+ accept_confirm { click_on "Submit" }
209
183
  end
210
184
 
211
185
  it_behaves_like "a correctly ordered questionnaire"
@@ -246,7 +220,7 @@ shared_examples_for "has questionnaire" do
246
220
  it "does not show message indicating number of characters left" do
247
221
  visit questionnaire_public_path
248
222
 
249
- expect(page).not_to have_content("characters left")
223
+ expect(page).to have_no_content("characters left")
250
224
  end
251
225
  end
252
226
  end
@@ -255,7 +229,7 @@ shared_examples_for "has questionnaire" do
255
229
  include_context "when a non multiple choice question is mandatory"
256
230
 
257
231
  before do
258
- click_button "Submit"
232
+ click_on "Submit"
259
233
  end
260
234
 
261
235
  it "submits the form and shows errors" do
@@ -268,14 +242,14 @@ shared_examples_for "has questionnaire" do
268
242
  include_context "when a non multiple choice question is mandatory"
269
243
 
270
244
  before do
271
- accept_confirm { click_button "Submit" }
245
+ accept_confirm { click_on "Submit" }
272
246
  end
273
247
 
274
248
  it "shows errors without submitting the form" do
275
- expect(page).not_to have_selector ".alert.flash"
249
+ expect(page).to have_no_css ".alert.flash"
276
250
  different_error = I18n.t("decidim.forms.questionnaires.answer.max_choices_alert")
277
251
  expect(different_error).to eq("There are too many choices selected")
278
- expect(page).not_to have_content(different_error)
252
+ expect(page).to have_no_content(different_error)
279
253
 
280
254
  expect(page).to have_content("cannot be blank")
281
255
  end
@@ -301,7 +275,7 @@ shared_examples_for "has questionnaire" do
301
275
 
302
276
  check "questionnaire_tos_agreement"
303
277
 
304
- accept_confirm { click_button "Submit" }
278
+ accept_confirm { click_on "Submit" }
305
279
  end
306
280
 
307
281
  it "submits the form and shows errors" do
@@ -316,7 +290,7 @@ shared_examples_for "has questionnaire" do
316
290
  it "properly interprets HTML descriptions" do
317
291
  visit questionnaire_public_path
318
292
 
319
- expect(page).to have_selector("b", text: "This question is important")
293
+ expect(page).to have_css("b", text: "This question is important")
320
294
  end
321
295
  end
322
296
 
@@ -361,7 +335,7 @@ shared_examples_for "has questionnaire" do
361
335
  let(:question_type) { "single_option" }
362
336
 
363
337
  it "renders them as radio buttons with attached text fields disabled by default" do
364
- 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)
365
339
 
366
340
  expect(page).to have_field("questionnaire_responses_0_choices_2_custom_body", disabled: true, count: 1)
367
341
 
@@ -375,7 +349,7 @@ shared_examples_for "has questionnaire" do
375
349
  fill_in "questionnaire_responses_0_choices_2_custom_body", with: "Cacatua"
376
350
 
377
351
  check "questionnaire_tos_agreement"
378
- accept_confirm { click_button "Submit" }
352
+ accept_confirm { click_on "Submit" }
379
353
 
380
354
  expect(page).to have_admin_callout(callout_success)
381
355
  expect(Decidim::Forms::Answer.first.choices.first.custom_body).to eq("Cacatua")
@@ -390,7 +364,7 @@ shared_examples_for "has questionnaire" do
390
364
  fill_in "questionnaire_responses_0_choices_2_custom_body", with: "Cacatua"
391
365
 
392
366
  check "questionnaire_tos_agreement"
393
- accept_confirm { click_button "Submit" }
367
+ accept_confirm { click_on "Submit" }
394
368
 
395
369
  expect(page).to have_admin_callout("There was a problem answering")
396
370
  expect(page).to have_field("questionnaire_responses_0_choices_2_custom_body", with: "Cacatua")
@@ -417,7 +391,7 @@ shared_examples_for "has questionnaire" do
417
391
  fill_in "questionnaire_responses_0_choices_2_custom_body", with: "Cacatua"
418
392
 
419
393
  check "questionnaire_tos_agreement"
420
- accept_confirm { click_button "Submit" }
394
+ accept_confirm { click_on "Submit" }
421
395
 
422
396
  expect(page).to have_admin_callout(callout_success)
423
397
  expect(Decidim::Forms::Answer.first.choices.first.custom_body).to eq("Cacatua")
@@ -432,7 +406,7 @@ shared_examples_for "has questionnaire" do
432
406
  fill_in "questionnaire_responses_0_choices_2_custom_body", with: "Cacatua"
433
407
 
434
408
  check "questionnaire_tos_agreement"
435
- accept_confirm { click_button "Submit" }
409
+ accept_confirm { click_on "Submit" }
436
410
 
437
411
  expect(page).to have_admin_callout("There was a problem answering")
438
412
  expect(page).to have_field("questionnaire_responses_0_choices_2_custom_body", with: "Cacatua")
@@ -449,7 +423,7 @@ shared_examples_for "has questionnaire" do
449
423
  it "renders the answer as a textarea" do
450
424
  visit questionnaire_public_path
451
425
 
452
- expect(page).to have_selector("textarea#questionnaire_responses_0")
426
+ expect(page).to have_css("textarea#questionnaire_responses_0")
453
427
  end
454
428
 
455
429
  it_behaves_like "question has a character limit"
@@ -475,13 +449,13 @@ shared_examples_for "has questionnaire" do
475
449
  it "renders answers as a collection of radio buttons" do
476
450
  visit questionnaire_public_path
477
451
 
478
- 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)
479
453
 
480
454
  choose answer_options[0]["body"][:en]
481
455
 
482
456
  check "questionnaire_tos_agreement"
483
457
 
484
- accept_confirm { click_button "Submit" }
458
+ accept_confirm { click_on "Submit" }
485
459
 
486
460
  expect(page).to have_admin_callout(callout_success)
487
461
 
@@ -499,16 +473,16 @@ shared_examples_for "has questionnaire" do
499
473
  it "renders answers as a collection of radio buttons" do
500
474
  visit questionnaire_public_path
501
475
 
502
- 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)
503
477
 
504
- expect(page).not_to have_content("Max choices:")
478
+ expect(page).to have_no_content("Max choices:")
505
479
 
506
480
  check answer_options[0]["body"][:en]
507
481
  check answer_options[1]["body"][:en]
508
482
 
509
483
  check "questionnaire_tos_agreement"
510
484
 
511
- accept_confirm { click_button "Submit" }
485
+ accept_confirm { click_on "Submit" }
512
486
 
513
487
  expect(page).to have_admin_callout(callout_success)
514
488
 
@@ -533,14 +507,14 @@ shared_examples_for "has questionnaire" do
533
507
 
534
508
  check "questionnaire_tos_agreement"
535
509
 
536
- accept_confirm { click_button "Submit" }
510
+ accept_confirm { click_on "Submit" }
537
511
 
538
512
  expect(page).to have_admin_callout("There was a problem answering")
539
513
  expect(page).to have_content("are too many")
540
514
 
541
515
  uncheck answer_options[2]["body"][:en]
542
516
 
543
- accept_confirm { click_button "Submit" }
517
+ accept_confirm { click_on "Submit" }
544
518
 
545
519
  expect(page).to have_admin_callout(callout_success)
546
520
  end
@@ -565,7 +539,7 @@ shared_examples_for "has questionnaire" do
565
539
  it "renders the question answers as a collection of divs sortable on drag and drop" do
566
540
  visit questionnaire_public_path
567
541
 
568
- 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)
569
543
 
570
544
  %w(We all like dark chocolate).each do |term|
571
545
  expect(page).to have_content(term)
@@ -581,7 +555,7 @@ shared_examples_for "has questionnaire" do
581
555
 
582
556
  check "questionnaire_tos_agreement"
583
557
 
584
- accept_confirm { click_button "Submit" }
558
+ accept_confirm { click_on "Submit" }
585
559
 
586
560
  expect(page).to have_admin_callout(callout_success)
587
561
  expect(Decidim::Forms::Answer.first.choices.pluck(:position, :body)).to eq(
@@ -609,7 +583,7 @@ shared_examples_for "has questionnaire" do
609
583
  it "renders the question answers as a collection of radio buttons" do
610
584
  visit questionnaire_public_path
611
585
 
612
- 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)
613
587
 
614
588
  expect(page).to have_content(matrix_rows.map { |row| row["body"]["en"] }.join("\n"))
615
589
  expect(page).to have_content(answer_options.map { |option| option["body"]["en"] }.join(" "))
@@ -621,7 +595,7 @@ shared_examples_for "has questionnaire" do
621
595
 
622
596
  check "questionnaire_tos_agreement"
623
597
 
624
- accept_confirm { click_button "Submit" }
598
+ accept_confirm { click_on "Submit" }
625
599
 
626
600
  expect(page).to have_admin_callout(callout_success)
627
601
 
@@ -642,7 +616,7 @@ shared_examples_for "has questionnaire" do
642
616
  radio_buttons = page.all(".js-radio-button-collection input[type=radio]")
643
617
  choose radio_buttons[1][:id]
644
618
 
645
- accept_confirm { click_button "Submit" }
619
+ accept_confirm { click_on "Submit" }
646
620
 
647
621
  expect(page).to have_admin_callout("There was a problem answering")
648
622
 
@@ -660,7 +634,7 @@ shared_examples_for "has questionnaire" do
660
634
  choose radio_buttons[0][:id]
661
635
 
662
636
  check "questionnaire_tos_agreement"
663
- accept_confirm { click_button "Submit" }
637
+ accept_confirm { click_on "Submit" }
664
638
 
665
639
  expect(page).to have_admin_callout("There was a problem answering")
666
640
  expect(page).to have_content("Choices are not complete")
@@ -689,7 +663,7 @@ shared_examples_for "has questionnaire" do
689
663
  it "renders the question answers as a collection of check boxes" do
690
664
  visit questionnaire_public_path
691
665
 
692
- 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)
693
667
 
694
668
  expect(page).to have_content(matrix_rows.map { |row| row["body"]["en"] }.join("\n"))
695
669
  expect(page).to have_content(answer_options.map { |option| option["body"]["en"] }.join(" "))
@@ -702,7 +676,7 @@ shared_examples_for "has questionnaire" do
702
676
 
703
677
  check "questionnaire_tos_agreement"
704
678
 
705
- accept_confirm { click_button "Submit" }
679
+ accept_confirm { click_on "Submit" }
706
680
 
707
681
  expect(page).to have_admin_callout(callout_success)
708
682
 
@@ -718,7 +692,7 @@ shared_examples_for "has questionnaire" do
718
692
  expect(third_choice).to eq([question.answer_options.first.id, question.matrix_rows.last.id])
719
693
  end
720
694
 
721
- context "when the question hax max_choices defined" do
695
+ context "when the question has max_choices defined" do
722
696
  let!(:max_choices) { 2 }
723
697
 
724
698
  it "respects the max number of choices" do
@@ -747,7 +721,7 @@ shared_examples_for "has questionnaire" do
747
721
 
748
722
  check "questionnaire_tos_agreement"
749
723
 
750
- accept_confirm { click_button "Submit" }
724
+ accept_confirm { click_on "Submit" }
751
725
 
752
726
  expect(page).to have_admin_callout("There was a problem answering")
753
727
  expect(page).to have_content("are too many")
@@ -756,7 +730,7 @@ shared_examples_for "has questionnaire" do
756
730
 
757
731
  uncheck checkboxes[5][:id]
758
732
 
759
- accept_confirm { click_button "Submit" }
733
+ accept_confirm { click_on "Submit" }
760
734
 
761
735
  expect(page).to have_admin_callout(callout_success)
762
736
  end
@@ -772,7 +746,7 @@ shared_examples_for "has questionnaire" do
772
746
  check checkboxes[0][:id]
773
747
 
774
748
  check "questionnaire_tos_agreement"
775
- accept_confirm { click_button "Submit" }
749
+ accept_confirm { click_on "Submit" }
776
750
 
777
751
  expect(page).to have_admin_callout("There was a problem answering")
778
752
  expect(page).to have_content("Choices are not complete")
@@ -792,7 +766,7 @@ shared_examples_for "has questionnaire" do
792
766
  check checkboxes[5][:id]
793
767
 
794
768
  check "questionnaire_tos_agreement"
795
- accept_confirm { click_button "Submit" }
769
+ accept_confirm { click_on "Submit" }
796
770
 
797
771
  expect(page).to have_admin_callout("There was a problem answering")
798
772
 
@@ -1332,7 +1306,7 @@ shared_examples_for "has questionnaire" do
1332
1306
 
1333
1307
  check "questionnaire_tos_agreement"
1334
1308
 
1335
- accept_confirm { click_button "Submit" }
1309
+ accept_confirm { click_on "Submit" }
1336
1310
 
1337
1311
  expect(page).to have_admin_callout(callout_success)
1338
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