specs: clear the React champ before adding a new value

This prevents the value from being
`Nouveau champ TexteLibellé de champ carte`.
This commit is contained in:
Pierre de La Morinerie 2019-06-03 12:47:03 +02:00
parent c05dc38b95
commit 2bd749a325

View file

@ -121,14 +121,14 @@ feature 'As an administrateur I can edit types de champ', js: true do
it "Add carte champ" do it "Add carte champ" do
select('Carte', from: 'champ-0-type_champ') select('Carte', from: 'champ-0-type_champ')
fill_in 'champ-0-libelle', with: 'libellé de champ carte' fill_in 'champ-0-libelle', with: 'Libellé de champ carte', fill_options: { clear: :backspace }
blur blur
check 'Quartiers prioritaires' check 'Quartiers prioritaires'
expect(page).to have_content('Formulaire enregistré') expect(page).to have_content('Formulaire enregistré')
preview_window = window_opened_by { click_on 'Prévisualiser le formulaire' } preview_window = window_opened_by { click_on 'Prévisualiser le formulaire' }
within_window(preview_window) do within_window(preview_window) do
expect(page).to have_content('libellé de champ carte') expect(page).to have_content('Libellé de champ carte')
expect(page).to have_content('Quartiers prioritaires') expect(page).to have_content('Quartiers prioritaires')
expect(page).not_to have_content('Cadastres') expect(page).not_to have_content('Cadastres')
end end