Merge pull request #7501 from betagouv/US/fix-missing-drop_down_other
fix(ChampEditor): add missing drop_down_other for type_de_champ.drop_down_list_with_other?
This commit is contained in:
commit
305dfdad11
3 changed files with 12 additions and 0 deletions
|
@ -40,6 +40,12 @@
|
||||||
.cell
|
.cell
|
||||||
= form.label :drop_down_list_value, "Options de la liste", for: dom_id(type_de_champ, :drop_down_list_value)
|
= form.label :drop_down_list_value, "Options de la liste", for: dom_id(type_de_champ, :drop_down_list_value)
|
||||||
= form.text_area :drop_down_list_value, class: 'small-margin small width-100', rows: 7, id: dom_id(type_de_champ, :drop_down_list_value)
|
= form.text_area :drop_down_list_value, class: 'small-margin small width-100', rows: 7, id: dom_id(type_de_champ, :drop_down_list_value)
|
||||||
|
- if type_de_champ.drop_down_list_with_other?
|
||||||
|
.cell
|
||||||
|
= form.label :drop_down_other do
|
||||||
|
Proposer une option 'autre' avec un texte libre
|
||||||
|
= form.check_box :drop_down_other, class: "small-margin small"
|
||||||
|
|
||||||
- if type_de_champ.linked_drop_down_list?
|
- if type_de_champ.linked_drop_down_list?
|
||||||
.flex.column.justify-start.flex-grow
|
.flex.column.justify-start.flex-grow
|
||||||
.cell
|
.cell
|
||||||
|
|
|
@ -202,6 +202,10 @@ class TypeDeChamp < ApplicationRecord
|
||||||
])
|
])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def drop_down_list_with_other?
|
||||||
|
type_champ == TypeDeChamp.type_champs.fetch(:drop_down_list)
|
||||||
|
end
|
||||||
|
|
||||||
def header_section?
|
def header_section?
|
||||||
type_champ == TypeDeChamp.type_champs.fetch(:header_section)
|
type_champ == TypeDeChamp.type_champs.fetch(:header_section)
|
||||||
end
|
end
|
||||||
|
|
|
@ -135,8 +135,10 @@ describe 'As an administrateur I can edit types de champ', js: true do
|
||||||
select('Choix parmi une liste', from: 'Type de champ')
|
select('Choix parmi une liste', from: 'Type de champ')
|
||||||
fill_in 'Libellé du champ', with: 'Libellé de champ menu déroulant', fill_options: { clear: :backspace }
|
fill_in 'Libellé du champ', with: 'Libellé de champ menu déroulant', fill_options: { clear: :backspace }
|
||||||
fill_in 'Options de la liste', with: 'Un menu', fill_options: { clear: :backspace }
|
fill_in 'Options de la liste', with: 'Un menu', fill_options: { clear: :backspace }
|
||||||
|
check "Proposer une option 'autre' avec un texte libre"
|
||||||
|
|
||||||
wait_until { procedure.draft_types_de_champ.first.drop_down_list_options == ['', 'Un menu'] }
|
wait_until { procedure.draft_types_de_champ.first.drop_down_list_options == ['', 'Un menu'] }
|
||||||
|
wait_until { procedure.draft_types_de_champ.first.drop_down_other == "1" }
|
||||||
expect(page).to have_content('Formulaire enregistré')
|
expect(page).to have_content('Formulaire enregistré')
|
||||||
|
|
||||||
page.refresh
|
page.refresh
|
||||||
|
|
Loading…
Reference in a new issue