decidim-forms 0.29.4 → 0.29.6

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/app/packs/src/decidim/forms/forms.js +47 -22
  3. data/app/views/decidim/forms/admin/questionnaires/_question.html.erb +1 -11
  4. data/app/views/decidim/forms/admin/questionnaires/_separator.html.erb +3 -10
  5. data/app/views/decidim/forms/admin/questionnaires/_title_and_description.html.erb +1 -11
  6. data/app/views/decidim/forms/questionnaires/_answer.html.erb +1 -1
  7. data/app/views/decidim/forms/questionnaires/answers/_long_answer.html.erb +1 -1
  8. data/app/views/decidim/forms/questionnaires/answers/_short_answer.html.erb +1 -1
  9. data/config/locales/ar.yml +0 -2
  10. data/config/locales/bg.yml +0 -6
  11. data/config/locales/ca-IT.yml +0 -6
  12. data/config/locales/ca.yml +0 -6
  13. data/config/locales/cs.yml +0 -6
  14. data/config/locales/de.yml +0 -6
  15. data/config/locales/el.yml +0 -6
  16. data/config/locales/en.yml +0 -6
  17. data/config/locales/es-MX.yml +0 -6
  18. data/config/locales/es-PY.yml +0 -6
  19. data/config/locales/es.yml +0 -6
  20. data/config/locales/eu.yml +1 -7
  21. data/config/locales/fi-plain.yml +0 -6
  22. data/config/locales/fi.yml +0 -6
  23. data/config/locales/fr-CA.yml +0 -6
  24. data/config/locales/fr.yml +0 -6
  25. data/config/locales/ga-IE.yml +0 -4
  26. data/config/locales/gl.yml +0 -4
  27. data/config/locales/hu.yml +0 -4
  28. data/config/locales/id-ID.yml +0 -2
  29. data/config/locales/it.yml +0 -4
  30. data/config/locales/ja.yml +0 -6
  31. data/config/locales/lb.yml +0 -4
  32. data/config/locales/lt.yml +0 -6
  33. data/config/locales/lv.yml +0 -4
  34. data/config/locales/nl.yml +0 -6
  35. data/config/locales/no.yml +0 -6
  36. data/config/locales/pl.yml +0 -6
  37. data/config/locales/pt-BR.yml +0 -6
  38. data/config/locales/pt.yml +0 -4
  39. data/config/locales/ro-RO.yml +0 -6
  40. data/config/locales/ru.yml +0 -2
  41. data/config/locales/sk.yml +0 -2
  42. data/config/locales/sv.yml +2 -8
  43. data/config/locales/tr-TR.yml +0 -4
  44. data/config/locales/val-ES.yml +0 -2
  45. data/config/locales/zh-CN.yml +0 -4
  46. data/config/locales/zh-TW.yml +0 -6
  47. data/lib/decidim/forms/test/shared_examples/has_questionnaire.rb +3 -2
  48. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb +122 -25
  49. data/lib/decidim/forms/test/shared_examples/manage_questionnaires.rb +5 -0
  50. data/lib/decidim/forms/version.rb +1 -1
  51. metadata +8 -8
@@ -32,20 +32,16 @@ gl:
32
32
  add_answer_option: Engadir unha opción de resposta
33
33
  any: Calquera
34
34
  description: Descrición
35
- down: Baixo
36
35
  question: Pregunta
37
36
  remove: Quitar
38
37
  statement: Declaración
39
- up: Arriba
40
38
  title_and_description:
41
39
  collapse: Contraer
42
40
  description: Descrición
43
- down: Abaixo
44
41
  expand: Expandir
45
42
  remove: Eliminar
46
43
  title: Título
47
44
  title_and_description: Título e descrición
48
- up: Arriba
49
45
  update:
50
46
  invalid: Produciuse un erro ao gardar o cuestionario.
51
47
  images:
@@ -35,21 +35,17 @@ hu:
35
35
  any: Bármilyen
36
36
  collapse: Összecsukás
37
37
  description: Leírás
38
- down: Le
39
38
  expand: Kibontás
40
39
  question: Kérdés
41
40
  remove: Eltávolít
42
41
  statement: Nyilatkozat
43
- up: Fel
44
42
  title_and_description:
45
43
  collapse: Összecsuk
46
44
  description: Leírás
47
- down: Le
48
45
  expand: Kibont
49
46
  remove: Eltávolít
50
47
  title: Cím
51
48
  title_and_description: Cím és leírás
52
- up: Fel
53
49
  update:
54
50
  invalid: Hiba történt a kérdőív mentésekor.
55
51
  images:
@@ -32,11 +32,9 @@ id:
32
32
  add_answer_option: Tambahkan opsi jawaban
33
33
  any: Apa saja
34
34
  description: Deskripsi
35
- down: Turun
36
35
  question: Pertanyaan
37
36
  remove: Menghapus
38
37
  statement: Pernyataan
39
- up: Naik
40
38
  update:
41
39
  invalid: Terjadi masalah saat menyimpan formulir.
42
40
  question_types:
@@ -74,17 +74,13 @@ it:
74
74
  any: Qualunque
75
75
  collapse: Comprimi
76
76
  description: Descrizione
77
- down: Giù
78
77
  expand: Espandi
79
78
  question: Domanda
80
79
  remove: Rimuovere
81
80
  statement: dichiarazione
82
- up: Su
83
81
  separator:
84
- down: Giù
85
82
  remove: Elimina
86
83
  separator: Separatore
87
- up: Su
88
84
  update:
89
85
  invalid: Si sono verificati errori durante il salvataggio del questionario.
90
86
  success: Modulo salvato correttamente.
@@ -101,26 +101,20 @@ ja:
101
101
  any: 任意の
102
102
  collapse: 折りたたむ
103
103
  description: 説明
104
- down: 下
105
104
  expand: 展開
106
105
  question: 質問
107
106
  remove: 削除
108
107
  statement: ステートメント
109
- up: 上へ
110
108
  separator:
111
- down: 下
112
109
  remove: 削除
113
110
  separator: 区切り記号
114
- up: 上へ
115
111
  title_and_description:
116
112
  collapse: 折りたたむ
117
113
  description: 説明
118
- down: 下へ
119
114
  expand: 展開する
120
115
  remove: 削除
121
116
  title: タイトル
122
117
  title_and_description: タイトルと説明
123
- up: 上へ
124
118
  update:
125
119
  invalid: フォームの保存に失敗しました。
126
120
  success: フォームを保存しました。
@@ -72,17 +72,13 @@ lb:
72
72
  any: Irgendein
73
73
  collapse: Zouklappen
74
74
  description: Beschreiwung
75
- down: Runter
76
75
  expand: Ausklappen
77
76
  question: Fro
78
77
  remove: Löschen
79
78
  statement: Aussage
80
- up: Hoch
81
79
  separator:
82
- down: Runter
83
80
  remove: Löschen
84
81
  separator: Trennzeichen
85
- up: Hoch
86
82
  update:
87
83
  invalid: Beim Speichern des Fragebogens sind Fehler aufgetreten.
88
84
  success: Formular erfolgreich gespeichert.
@@ -76,26 +76,20 @@ lt:
76
76
  any: Bet koks
77
77
  collapse: Suskleisti
78
78
  description: Aprašymas
79
- down: Žemyn
80
79
  expand: Išplėsti
81
80
  question: Klausimas
82
81
  remove: Pašalinti
83
82
  statement: Pareiškimas
84
- up: Į viršų
85
83
  separator:
86
- down: Žemyn
87
84
  remove: Pašalinti
88
85
  separator: Skirtukas
89
- up: Į viršų
90
86
  title_and_description:
91
87
  collapse: Suskleisti
92
88
  description: Aprašymas
93
- down: Žemyn
94
89
  expand: Išplėsti
95
90
  remove: Pašalinti
96
91
  title: Pavadinimas
97
92
  title_and_description: Pavadinimas ir aprašymas
98
- up: Aukštyn
99
93
  update:
100
94
  invalid: Išsaugant šią formą iškilo problema.
101
95
  success: Forma sėkmingai išsaugota.
@@ -38,17 +38,13 @@ lv:
38
38
  any: Jebkura
39
39
  collapse: Sakļaut
40
40
  description: Apraksts
41
- down: Lejup
42
41
  expand: Izvērst
43
42
  question: Jautājums
44
43
  remove: Noņemt
45
44
  statement: Paziņojums
46
- up: Augšup
47
45
  separator:
48
- down: Lejup
49
46
  remove: Noņemt
50
47
  separator: Atdalītājs
51
- up: Augšup
52
48
  update:
53
49
  invalid: Saglabājot veidlapu, radās problēma.
54
50
  images:
@@ -70,26 +70,20 @@ nl:
70
70
  any: Ieder
71
71
  collapse: Samenvouwen
72
72
  description: Omschrijving
73
- down: naar beneden
74
73
  expand: Uitklappen
75
74
  question: Vraag
76
75
  remove: Verwijderen
77
76
  statement: Uitspraak
78
- up: omhoog
79
77
  separator:
80
- down: Omlaag
81
78
  remove: Verwijderen
82
79
  separator: Scheidingsteken
83
- up: Omhoog
84
80
  title_and_description:
85
81
  collapse: Inklappen
86
82
  description: Beschrijving
87
- down: Naar beneden
88
83
  expand: Uitklappen
89
84
  remove: Verwijderen
90
85
  title: Titel
91
86
  title_and_description: Titel en beschrijving
92
- up: Naar boven
93
87
  update:
94
88
  invalid: Er zijn fouten opgetreden bij het opslaan van de vragenlijst.
95
89
  success: Formulier succesvol opgeslagen.
@@ -72,26 +72,20 @@
72
72
  any: Alle
73
73
  collapse: Skjul
74
74
  description: Beskrivelse
75
- down: Ned
76
75
  expand: Utvid
77
76
  question: Spørsmål
78
77
  remove: Fjern
79
78
  statement: Uttalelse
80
- up: Opp
81
79
  separator:
82
- down: Ned
83
80
  remove: Fjern
84
81
  separator: Skilletegn
85
- up: Opp
86
82
  title_and_description:
87
83
  collapse: Kollaps
88
84
  description: Beskrivelse
89
- down: Ned
90
85
  expand: Utvid
91
86
  remove: Fjern
92
87
  title: Tittel
93
88
  title_and_description: Tittel og beskrivelse
94
- up: Opp
95
89
  update:
96
90
  invalid: Det oppstod et problem med å lagre dette skjema.
97
91
  success: Skjemaet ble lagret.
@@ -76,26 +76,20 @@ pl:
76
76
  any: Dowolny
77
77
  collapse: Zwiń
78
78
  description: Opis
79
- down: Na dół
80
79
  expand: Rozwiń
81
80
  question: Pytanie
82
81
  remove: Usuń
83
82
  statement: Komunikat
84
- up: W górę
85
83
  separator:
86
- down: Na dół
87
84
  remove: Usuń
88
85
  separator: Separator
89
- up: W górę
90
86
  title_and_description:
91
87
  collapse: Zwiń
92
88
  description: Opis
93
- down: W dół
94
89
  expand: Rozwiń
95
90
  remove: Usuń
96
91
  title: Tytuł
97
92
  title_and_description: Tytuł i opis
98
- up: W górę
99
93
  update:
100
94
  invalid: Podczas zapisywania formularza wystąpił błąd.
101
95
  success: Formularz został zapisany.
@@ -72,26 +72,20 @@ pt-BR:
72
72
  any: Qualquer
73
73
  collapse: Recolher
74
74
  description: Descrição
75
- down: Baixa
76
75
  expand: Expandir
77
76
  question: Questão
78
77
  remove: Remover
79
78
  statement: Declaração
80
- up: Acima
81
79
  separator:
82
- down: Para Baixo
83
80
  remove: Remover
84
81
  separator: Separador
85
- up: Para Cima
86
82
  title_and_description:
87
83
  collapse: Recolher
88
84
  description: Descrição
89
- down: Abaixo
90
85
  expand: Expandir
91
86
  remove: Excluir
92
87
  title: Título
93
88
  title_and_description: Título e descrição
94
- up: Acima
95
89
  update:
96
90
  invalid: Houve erros ao salvar o questionário.
97
91
  success: Formulário salvo com sucesso.
@@ -72,17 +72,13 @@ pt:
72
72
  any: Qualquer
73
73
  collapse: Colapsar
74
74
  description: Descrição
75
- down: Abaixo
76
75
  expand: Expandir
77
76
  question: Questão
78
77
  remove: Remover
79
78
  statement: Declaração
80
- up: Acima
81
79
  separator:
82
- down: Abaixo
83
80
  remove: Remover
84
81
  separator: Separador
85
- up: Acima
86
82
  update:
87
83
  invalid: Ocorreu um problema ao guardar o questionário.
88
84
  success: Formulário guardado com êxito
@@ -89,26 +89,20 @@ ro:
89
89
  any: Oricare
90
90
  collapse: Restrângeți
91
91
  description: Descriere
92
- down: Mergi în jos
93
92
  expand: Extindeți
94
93
  question: Întrebare
95
94
  remove: Eliminați
96
95
  statement: Declarație
97
- up: Mergi în sus
98
96
  separator:
99
- down: Mergi în jos
100
97
  remove: Elimină
101
98
  separator: Separator
102
- up: Mergi în sus
103
99
  title_and_description:
104
100
  collapse: Restrângeți
105
101
  description: Descriere
106
- down: Mergi în jos
107
102
  expand: Extindeți
108
103
  remove: Șterge
109
104
  title: Titlu
110
105
  title_and_description: Titlu și descriere
111
- up: Mergi în sus
112
106
  update:
113
107
  invalid: A apărut o eroare la salvarea chestionarului.
114
108
  success: Chestionarul a fost salvat cu succes.
@@ -20,10 +20,8 @@ ru:
20
20
  question:
21
21
  add_answer_option: Добавить вариант ответа
22
22
  any: Любые
23
- down: Вниз
24
23
  question: Вопрос
25
24
  remove: Удалить
26
- up: Вверх
27
25
  update:
28
26
  invalid: При попытке сохранить форму произошли ошибки.
29
27
  question_types:
@@ -32,11 +32,9 @@ sk:
32
32
  add_answer_option: Pridať možnosť odpovede
33
33
  any: Akékoľvek
34
34
  description: Popis
35
- down: Nadol
36
35
  question: Otázka
37
36
  remove: Odstrániť
38
37
  statement: Prehlásenie
39
- up: Hore
40
38
  update:
41
39
  invalid: Vyskytol sa problém s ukladaním formulára.
42
40
  question_types:
@@ -100,26 +100,20 @@ sv:
100
100
  any: Valfritt
101
101
  collapse: Dölj
102
102
  description: Beskrivning
103
- down: Ner
104
103
  expand: Visa
105
104
  question: Fråga
106
105
  remove: Ta bort
107
106
  statement: Titel
108
- up: Upp
109
107
  separator:
110
- down: Ner
111
108
  remove: Ta bort
112
109
  separator: Avgränsare
113
- up: Upp
114
110
  title_and_description:
115
111
  collapse: Dölj
116
112
  description: Beskrivning
117
- down: Ner
118
113
  expand: Visa
119
114
  remove: Ta bort
120
115
  title: Titel
121
116
  title_and_description: Titel och beskrivning
122
- up: Upp
123
117
  update:
124
118
  invalid: Det gick inte att spara formuläret.
125
119
  success: Formuläret har sparats.
@@ -177,10 +171,10 @@ sv:
177
171
  title: JavaScript är inaktiverat
178
172
  questionnaire_not_published:
179
173
  body: Formulär är ännu inte publicerat.
180
- tos_agreement: Genom att fortsätta godkänner du användarvillkoren
174
+ tos_agreement: Genom att fortsätta godkänner du villkoren för anmälan
181
175
  step_navigation:
182
176
  show:
183
- are_you_sure: Den här åtgärden kan inte ångras och du kommer inte att kunna redigera dina svar. Vill du fortsätta?
177
+ are_you_sure: Efter att du har skickat in anmälan kan du inte ändra i den. Vill du fortsätta?
184
178
  back: Tillbaka
185
179
  continue: Fortsätt
186
180
  submit: Skicka
@@ -71,17 +71,13 @@ tr:
71
71
  any: herhangi
72
72
  collapse: Daralt
73
73
  description: Açıklama
74
- down: Aşağı
75
74
  expand: Genişlet
76
75
  question: Soru
77
76
  remove: Kaldır
78
77
  statement: Beyan
79
- up: yukarı
80
78
  separator:
81
- down: Aşağı
82
79
  remove: Kaldır
83
80
  separator: Ayraç
84
- up: Yukarı
85
81
  update:
86
82
  invalid: Formu kaydederken bir sorun oluştu.
87
83
  success: Başarıyla kaydedildi.
@@ -7,11 +7,9 @@ val:
7
7
  title_and_description:
8
8
  collapse: Redueix
9
9
  description: Descripció
10
- down: Baixar
11
10
  expand: Expandeix
12
11
  remove: Elimina
13
12
  title: Títol
14
13
  title_and_description: Títol i descripció
15
- up: Pujar
16
14
  question_types:
17
15
  title_and_description: Títol i descripció
@@ -70,17 +70,13 @@ zh-CN:
70
70
  any: 任何
71
71
  collapse: 收起
72
72
  description: 描述
73
- down: 向下
74
73
  expand: 扩展
75
74
  question: 问
76
75
  remove: 删除
77
76
  statement: 声明
78
- up: 上移
79
77
  separator:
80
- down: 向下
81
78
  remove: 删除
82
79
  separator: 分隔符
83
- up: 上移
84
80
  update:
85
81
  invalid: 保存表单时出错。
86
82
  success: 表单保存成功。
@@ -76,26 +76,20 @@ zh-TW:
76
76
  any: 任何
77
77
  collapse: 收回
78
78
  description: 說明
79
- down: 向下
80
79
  expand: 展開
81
80
  question: 問題
82
81
  remove: 移除
83
82
  statement: 聲明
84
- up: 往上
85
83
  separator:
86
- down: 向下
87
84
  remove: 移除
88
85
  separator: 分隔線
89
- up: 往上
90
86
  title_and_description:
91
87
  collapse: 收回
92
88
  description: 說明
93
- down: 向下
94
89
  expand: 展開
95
90
  remove: 移除
96
91
  title: 標題
97
92
  title_and_description: 標題和描述
98
- up: 往上
99
93
  update:
100
94
  invalid: 儲存表單時發生問題。
101
95
  success: 表單已成功儲存。
@@ -271,8 +271,9 @@ shared_examples_for "has questionnaire" do
271
271
  accept_confirm { click_on "Submit" }
272
272
  end
273
273
 
274
- it "shows errors without submitting the form" do
275
- expect(page).to have_no_css ".alert.flash"
274
+ it "submits the form and shows errors" do
275
+ expect(page).to have_css ".alert.flash"
276
+ expect(page).to have_admin_callout(callout_failure)
276
277
  different_error = I18n.t("decidim.forms.questionnaires.answer.max_choices_alert")
277
278
  expect(different_error).to eq("There are too many choices selected")
278
279
  expect(page).to have_no_content(different_error)
@@ -352,6 +352,10 @@ shared_examples_for "update questions" do
352
352
  create(:questionnaire_question, questionnaire:, body: second_body, position: 1)
353
353
  end
354
354
 
355
+ let!(:question3) do
356
+ create(:questionnaire_question, questionnaire:, body: third_body, position: 2)
357
+ end
358
+
355
359
  let(:first_body) do
356
360
  { en: "First", ca: "Primera", es: "Primera" }
357
361
  end
@@ -360,6 +364,10 @@ shared_examples_for "update questions" do
360
364
  { en: "Second", ca: "Segona", es: "Segunda" }
361
365
  end
362
366
 
367
+ let(:third_body) do
368
+ { en: "Third", ca: "Tercera", es: "Tercera" }
369
+ end
370
+
363
371
  before do
364
372
  visit questionnaire_edit_path
365
373
  expand_all_questions
@@ -379,26 +387,6 @@ shared_examples_for "update questions" do
379
387
  end
380
388
  end
381
389
 
382
- context "when moving a question up" do
383
- before do
384
- within ".questionnaire-question:last-of-type" do
385
- click_on "Up"
386
- end
387
- end
388
-
389
- it_behaves_like "switching questions order"
390
- end
391
-
392
- context "when moving a question down" do
393
- before do
394
- within ".questionnaire-question:first-of-type" do
395
- click_on "Down"
396
- end
397
- end
398
-
399
- it_behaves_like "switching questions order"
400
- end
401
-
402
390
  describe "collapsible questions" do
403
391
  context "when clicking on Expand all button" do
404
392
  it "expands all questions" do
@@ -494,16 +482,37 @@ shared_examples_for "update questions" do
494
482
  click_on "Add question"
495
483
  expand_all_questions
496
484
 
497
- expect(page.find(".questionnaire-question:nth-of-type(1)")).to look_like_first_question
498
- expect(page.find(".questionnaire-question:nth-of-type(2)")).to look_like_intermediate_question
499
- expect(page.find(".questionnaire-question:nth-of-type(3)")).to look_like_last_question
485
+ question_cards = page.all(".questionnaire-question")
486
+ expect(question_cards.size).to eq(4)
487
+
488
+ within question_cards[1] do
489
+ expect(find("input[name*='[body_en]']").value).to eq("Second")
490
+ end
491
+ within question_cards[2] do
492
+ expect(find("input[name*='[body_en]']").value).to eq("Third")
493
+ end
500
494
 
501
495
  within ".questionnaire-question:first-of-type" do
502
496
  click_on "Remove"
503
497
  end
504
498
 
505
- expect(page.all(".questionnaire-question").first).to look_like_first_question
506
- expect(page.all(".questionnaire-question").last).to look_like_last_question
499
+ remaining_cards = page.all(".questionnaire-question")
500
+ expect(remaining_cards.size).to eq(3)
501
+
502
+ # Check that the first question is now what was previously the second
503
+ within remaining_cards.first do
504
+ expect(find("input[name*='[body_en]']").value).to eq("Second")
505
+ end
506
+
507
+ # Check that the second question is now what was previously the third
508
+ within remaining_cards[1] do
509
+ expect(find("input[name*='[body_en]']").value).to eq("Third")
510
+ end
511
+
512
+ # The last question should be the new empty question
513
+ within remaining_cards.last do
514
+ expect(find("input[name*='[body_en]']").value).to eq("")
515
+ end
507
516
  end
508
517
 
509
518
  it "does not duplicate editors when adding new questions" do
@@ -547,6 +556,94 @@ shared_examples_for "update questions" do
547
556
  end
548
557
  end
549
558
 
559
+ context "when reordering questions with drag and drop", :js do
560
+ before do
561
+ expand_all_questions
562
+ end
563
+
564
+ it "allows moving questions using drag and drop" do
565
+ question_cards = all(".questionnaire-question")
566
+
567
+ # Verify initial order by checking the body field values
568
+ within question_cards[0] do
569
+ expect(find("input[name*='[body_en]']").value).to eq("First")
570
+ end
571
+ within question_cards[1] do
572
+ expect(find("input[name*='[body_en]']").value).to eq("Second")
573
+ end
574
+ within question_cards[2] do
575
+ expect(find("input[name*='[body_en]']").value).to eq("Third")
576
+ end
577
+
578
+ # JavaScript to simulate drag and drop.
579
+ page.execute_script(<<~JS)
580
+ var questions = document.querySelectorAll('.questionnaire-question');
581
+ var container = questions[0].parentNode;
582
+ var second = questions[1];
583
+ var first = questions[0];
584
+
585
+ // Move second question before first
586
+ container.insertBefore(second, first);
587
+
588
+ // Update position values
589
+ var updatedQuestions = container.querySelectorAll('.questionnaire-question');
590
+ updatedQuestions.forEach(function(question, index) {
591
+ var positionInput = question.querySelector('input[name$="[position]"]');
592
+ if (positionInput) positionInput.value = index;
593
+ });
594
+ JS
595
+
596
+ sleep 0.5
597
+
598
+ question_cards = all(".questionnaire-question")
599
+ within question_cards[0] do
600
+ expect(find("input[name*='[body_en]']").value).to eq("Second")
601
+ end
602
+ within question_cards[1] do
603
+ expect(find("input[name*='[body_en]']").value).to eq("First")
604
+ end
605
+ within question_cards[2] do
606
+ expect(find("input[name*='[body_en]']").value).to eq("Third")
607
+ end
608
+ end
609
+
610
+ it "persists drag and drop changes when saving" do
611
+ # Move second question to last position
612
+ page.execute_script(<<~JS)
613
+ var questions = document.querySelectorAll('.questionnaire-question');
614
+ var container = questions[0].parentNode;
615
+ var second = questions[1];
616
+
617
+ container.appendChild(second);
618
+
619
+ // Update the positions of questions
620
+ var updatedQuestions = container.querySelectorAll('.questionnaire-question');
621
+ updatedQuestions.forEach(function(question, index) {
622
+ var positionInput = question.querySelector('input[name$="[position]"]');
623
+ if (positionInput) positionInput.value = index;
624
+ });
625
+ JS
626
+
627
+ sleep 0.5
628
+
629
+ click_on "Save"
630
+ expect(page).to have_admin_callout("successfully")
631
+
632
+ visit_manage_questions_and_expand_all
633
+
634
+ question_cards = all(".questionnaire-question")
635
+ within question_cards[0] do
636
+ expect(find("input[name*='[body_en]']").value).to eq("First")
637
+ end
638
+ within question_cards[1] do
639
+ expect(find("input[name*='[body_en]']").value).to eq("Third")
640
+ end
641
+ within question_cards[2] do
642
+ expect(find("input[name*='[body_en]']").value).to eq("Second")
643
+ end
644
+ end
645
+ end
646
+
550
647
  private
551
648
 
552
649
  def look_like_first_question