decidim-forms 0.28.2 → 0.29.0.rc2
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 +1 -1
- 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 +0 -1
- 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 +15 -11
data/config/locales/it.yml
CHANGED
data/config/locales/ja.yml
CHANGED
data/config/locales/lb.yml
CHANGED
data/config/locales/lt.yml
CHANGED
@@ -22,7 +22,6 @@ lt:
|
|
22
22
|
too_long: per ilgas
|
23
23
|
choices:
|
24
24
|
missing: nepilnas - trūksta elementų
|
25
|
-
too_many: per daug
|
26
25
|
questionnaire:
|
27
26
|
request_invalid: Tvarkant prašymą įvyko klaida. Bandykite dar kartą.
|
28
27
|
decidim:
|
@@ -158,7 +157,6 @@ lt:
|
|
158
157
|
answer_questionnaire:
|
159
158
|
already_have_an_account?: Jau turite paskyrą?
|
160
159
|
are_you_new?: Naujas naudotojas?
|
161
|
-
sign_in_description: Prisijunkite norėdami dalyvauti apklausoje
|
162
160
|
sign_up_description: Norėdami dalyvauti apklausoje, susikurkite dalyvio paskyrą
|
163
161
|
title: Atsakyti į formos klausimus
|
164
162
|
current_step: Žingsnis %{step}
|
data/config/locales/lv.yml
CHANGED
data/config/locales/nl.yml
CHANGED
data/config/locales/no.yml
CHANGED
data/config/locales/pl.yml
CHANGED
data/config/locales/pt-BR.yml
CHANGED
data/config/locales/pt.yml
CHANGED
data/config/locales/ro-RO.yml
CHANGED
@@ -22,7 +22,6 @@ ro:
|
|
22
22
|
too_long: este prea lung
|
23
23
|
choices:
|
24
24
|
missing: nu sunt completate
|
25
|
-
too_many: sunt prea multe
|
26
25
|
questionnaire:
|
27
26
|
request_invalid: A apărut o eroare la procesarea cererii. Te rugăm să încerci din nou.
|
28
27
|
decidim:
|
@@ -158,7 +157,6 @@ ro:
|
|
158
157
|
answer_questionnaire:
|
159
158
|
already_have_an_account?: Ai deja un cont?
|
160
159
|
are_you_new?: Utilizator nou?
|
161
|
-
sign_in_description: Autentifică-te pentru a participa la sondaj
|
162
160
|
sign_up_description: Creați un cont de participant pentru a participa la sondaj
|
163
161
|
title: Completează chestionarul
|
164
162
|
current_step: Pasul %{step}
|
data/config/locales/sk.yml
CHANGED
data/config/locales/sv.yml
CHANGED
data/config/locales/tr-TR.yml
CHANGED
data/config/locales/zh-CN.yml
CHANGED
data/config/locales/zh-TW.yml
CHANGED
@@ -22,7 +22,6 @@ zh-TW:
|
|
22
22
|
too_long: 太長
|
23
23
|
choices:
|
24
24
|
missing: 尚未完成
|
25
|
-
too_many: 太多了
|
26
25
|
questionnaire:
|
27
26
|
request_invalid: 處理請求時發生錯誤。請再試一次。
|
28
27
|
decidim:
|
@@ -158,7 +157,6 @@ zh-TW:
|
|
158
157
|
answer_questionnaire:
|
159
158
|
already_have_an_account?: 已經有帳號了嗎?
|
160
159
|
are_you_new?: 新用戶?
|
161
|
-
sign_in_description: 登入以填寫問卷
|
162
160
|
sign_up_description: 建立參與者帳號以填寫問卷
|
163
161
|
title: 回答表單
|
164
162
|
current_step: 步驟%{step}
|
@@ -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
|
data/decidim-forms.gemspec
CHANGED
@@ -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.
|
22
|
+
s.required_ruby_version = "~> 3.2.0"
|
23
23
|
|
24
24
|
s.name = "decidim-forms"
|
25
25
|
s.summary = "Decidim forms"
|
@@ -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).
|
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
|
-
|
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).
|
72
|
+
expect(page).to have_no_content("Back")
|
73
73
|
end
|
74
74
|
|
75
75
|
answer_first_questionnaire
|
76
76
|
|
77
|
-
expect(page).
|
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
|
-
|
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 {
|
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).
|
104
|
+
expect(page).to have_no_css("#questionnaire_tos_agreement")
|
105
105
|
|
106
106
|
fill_in question.body["en"], with: "My first answer"
|
107
|
-
|
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).
|
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 {
|
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).
|
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
|
-
|
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 {
|
245
|
+
accept_confirm { click_on "Submit" }
|
246
246
|
end
|
247
247
|
|
248
248
|
it "shows errors without submitting the form" do
|
249
|
-
expect(page).
|
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).
|
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 {
|
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
|
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
|
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 {
|
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 {
|
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 {
|
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 {
|
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
|
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
|
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 {
|
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
|
476
|
+
expect(page).to have_css(".js-check-box-collection input[type=checkbox]", count: 3)
|
477
477
|
|
478
|
-
expect(page).
|
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 {
|
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 {
|
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 {
|
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
|
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 {
|
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
|
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 {
|
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 {
|
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 {
|
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
|
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 {
|
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
|
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 {
|
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 {
|
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 {
|
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 {
|
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 {
|
1309
|
+
accept_confirm { click_on "Submit" }
|
1310
1310
|
|
1311
1311
|
expect(page).to have_admin_callout(callout_success)
|
1312
1312
|
end
|