This commit is contained in:
kara Diaby 2021-10-22 14:46:53 +02:00
parent c2fcd3992d
commit 71aa13f468

View file

@ -0,0 +1,43 @@
describe 'dropdown list with other option activated' do
let(:password) { 'my-s3cure-p4ssword' }
let!(:user) { create(:user, password: password) }
let(:list_items) do
<<~END_OF_LIST
--Primary 1--
Secondary 1.1
Secondary 1.2
END_OF_LIST
end
let(:type_de_champ) { build(:type_de_champ_drop_down_list, libelle: 'simple dropdown other', drop_down_list_value: list_items, drop_down_other: true) }
let(:procedure) do
create(:procedure, :published, :for_individual, types_de_champ: [type_de_champ])
end
let(:user_dossier) { user.dossiers.first }
before do
login_as(user, scope: :user)
visit "/commencer/#{procedure.path}"
click_on 'Commencer la démarche'
end
scenario 'Select other option and the other input hidden must appear', js: true do
fill_individual
find('.radios').find('label:last-child').find('input').select_option
expect(page).to have_selector('.drop_down_other', visible: true)
end
private
def fill_individual
choose 'Monsieur'
fill_in('individual_prenom', with: 'prenom')
fill_in('individual_nom', with: 'nom')
click_on 'Continuer'
expect(page).to have_current_path(brouillon_dossier_path(user_dossier))
end
end