Merge pull request #10804 from tchak/better_drop_down_other_option
Drop down other label set to 'Enter another option' instead of 'Other'
This commit is contained in:
commit
9924b2d640
6 changed files with 12 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
||||||
.drop_down_other.fr-mt-2w
|
.drop_down_other.fr-mt-2w
|
||||||
.fr-input-group
|
.fr-input-group
|
||||||
%label.fr-label{ for: dom_id(@champ, :value_other) } Veuillez saisir votre autre choix
|
%label.fr-label{ for: dom_id(@champ, :value_other) }
|
||||||
|
= t('shared.champs.drop_down_list.other_label')
|
||||||
= @form.text_field :value_other, maxlength: 200, size: nil, id: dom_id(@champ, :value_other), class: 'fr-input'
|
= @form.text_field :value_other, maxlength: 200, size: nil, id: dom_id(@champ, :value_other), class: 'fr-input'
|
||||||
|
|
|
@ -134,7 +134,7 @@ ignore_unused:
|
||||||
|
|
||||||
## Ignore these keys completely:
|
## Ignore these keys completely:
|
||||||
ignore:
|
ignore:
|
||||||
- 'shared.champs.drop_down_list{,.other}' # pluralization "other" false positive
|
- 'shared.champs.drop_down_list{,.other,.other_label}' # pluralization "other" false positive
|
||||||
|
|
||||||
## Sometimes, it isn't possible for i18n-tasks to match the key correctly,
|
## Sometimes, it isn't possible for i18n-tasks to match the key correctly,
|
||||||
## e.g. in case of a relative key defined in a helper method.
|
## e.g. in case of a relative key defined in a helper method.
|
||||||
|
|
|
@ -53,4 +53,5 @@ en:
|
||||||
data_fetched: "Data concerning %{sources} linked to the INE %{ine} has been received from the MESRI."
|
data_fetched: "Data concerning %{sources} linked to the INE %{ine} has been received from the MESRI."
|
||||||
data_fetched_title: "Data received from the MESRI"
|
data_fetched_title: "Data received from the MESRI"
|
||||||
drop_down_list:
|
drop_down_list:
|
||||||
other: Other
|
other: Enter another option
|
||||||
|
other_label: Enter your option
|
||||||
|
|
|
@ -55,4 +55,5 @@ fr:
|
||||||
data_fetched: "Des données concernant %{sources} liées à l’INE %{ine} ont été reçues depuis le MESRI."
|
data_fetched: "Des données concernant %{sources} liées à l’INE %{ine} ont été reçues depuis le MESRI."
|
||||||
data_fetched_title: "Données obtenues du MESRI"
|
data_fetched_title: "Données obtenues du MESRI"
|
||||||
drop_down_list:
|
drop_down_list:
|
||||||
other: Autre
|
other: Entrer une autre option
|
||||||
|
other_label: Saisir votre option
|
||||||
|
|
|
@ -77,7 +77,7 @@ describe Logic::ChampValue do
|
||||||
let(:drop_down_other) { true }
|
let(:drop_down_other) { true }
|
||||||
|
|
||||||
it { is_expected.to eq('val1') }
|
it { is_expected.to eq('val1') }
|
||||||
it { expect(champ_value(champ.stable_id).options([champ.type_de_champ])).to match_array([["val1", "val1"], ["val2", "val2"], ["val3", "val3"], ["Autre", "__other__"]]) }
|
it { expect(champ_value(champ.stable_id).options([champ.type_de_champ])).to match_array([["val1", "val1"], ["val2", "val2"], ["val3", "val3"], [I18n.t('shared.champs.drop_down_list.other'), "__other__"]]) }
|
||||||
|
|
||||||
context 'with other filled' do
|
context 'with other filled' do
|
||||||
let(:other) { true }
|
let(:other) { true }
|
||||||
|
|
|
@ -25,15 +25,15 @@ describe 'dropdown list with other option activated', js: true do
|
||||||
scenario 'Select other option and the other input hidden must appear' do
|
scenario 'Select other option and the other input hidden must appear' do
|
||||||
fill_individual
|
fill_individual
|
||||||
|
|
||||||
choose "Autre"
|
choose I18n.t('shared.champs.drop_down_list.other')
|
||||||
expect(page).to have_selector('.drop_down_other', visible: true)
|
expect(page).to have_selector('.drop_down_other', visible: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Getting back from other save the new option" do
|
scenario "Getting back from other save the new option" do
|
||||||
fill_individual
|
fill_individual
|
||||||
|
|
||||||
choose "Autre"
|
choose I18n.t('shared.champs.drop_down_list.other')
|
||||||
fill_in("Veuillez saisir votre autre choix", with: "My choice")
|
fill_in(I18n.t('shared.champs.drop_down_list.other_label'), with: "My choice")
|
||||||
|
|
||||||
wait_until { user_dossier.champs_public.first.value == "My choice" }
|
wait_until { user_dossier.champs_public.first.value == "My choice" }
|
||||||
expect(user_dossier.champs_public.first.value).to eq("My choice")
|
expect(user_dossier.champs_public.first.value).to eq("My choice")
|
||||||
|
@ -62,7 +62,7 @@ describe 'dropdown list with other option activated', js: true do
|
||||||
fill_individual
|
fill_individual
|
||||||
|
|
||||||
expect(page).not_to have_selector(".drop_down_other input")
|
expect(page).not_to have_selector(".drop_down_other input")
|
||||||
select("Autre")
|
select(I18n.t('shared.champs.drop_down_list.other'))
|
||||||
find(".drop_down_other input", visible: true)
|
find(".drop_down_other input", visible: true)
|
||||||
|
|
||||||
select("Secondary 1.2")
|
select("Secondary 1.2")
|
||||||
|
|
Loading…
Reference in a new issue