Merge pull request #4139 from Keirua/fix/confirm-on-delete-champ
#4137 - Ajout d'un confirm à la suppression d'un champ
This commit is contained in:
commit
6f3fde21f2
3 changed files with 17 additions and 7 deletions
|
@ -68,9 +68,13 @@ const TypeDeChamp = sortableElement(
|
|||
<div className="flex justify-start delete">
|
||||
<button
|
||||
className="button small icon-only danger"
|
||||
onClick={() =>
|
||||
dispatch({ type: 'removeTypeDeChamp', params: { typeDeChamp } })
|
||||
}
|
||||
onClick={() => {
|
||||
if (confirm('Êtes vous sûr de vouloir supprimer ce champ ?'))
|
||||
dispatch({
|
||||
type: 'removeTypeDeChamp',
|
||||
params: { typeDeChamp }
|
||||
});
|
||||
}}
|
||||
>
|
||||
<FontAwesomeIcon icon="trash" title="Supprimer" />
|
||||
</button>
|
||||
|
|
|
@ -513,6 +513,7 @@ ActiveRecord::Schema.define(version: 2019_07_17_151228) do
|
|||
t.boolean "durees_conservation_required", default: true
|
||||
t.string "path"
|
||||
t.string "declarative_with_state"
|
||||
t.text "monavis"
|
||||
t.text "monavis_embed"
|
||||
t.index ["declarative_with_state"], name: "index_procedures_on_declarative_with_state"
|
||||
t.index ["hidden_at"], name: "index_procedures_on_hidden_at"
|
||||
|
|
|
@ -11,7 +11,9 @@ feature 'As an administrateur I can edit types de champ', js: true do
|
|||
end
|
||||
|
||||
it "Add a new champ" do
|
||||
click_on 'Supprimer'
|
||||
page.accept_alert do
|
||||
click_on 'Supprimer'
|
||||
end
|
||||
|
||||
within '.buttons' do
|
||||
click_on 'Ajouter un champ'
|
||||
|
@ -48,7 +50,9 @@ feature 'As an administrateur I can edit types de champ', js: true do
|
|||
expect(page).to have_selector('#champ-3-libelle')
|
||||
|
||||
within '.type-de-champ[data-index="2"]' do
|
||||
click_on 'Supprimer'
|
||||
page.accept_alert do
|
||||
click_on 'Supprimer'
|
||||
end
|
||||
end
|
||||
|
||||
expect(page).not_to have_selector('#champ-3-libelle')
|
||||
|
@ -68,8 +72,9 @@ feature 'As an administrateur I can edit types de champ', js: true do
|
|||
blur
|
||||
expect(page).to have_content('Formulaire enregistré')
|
||||
page.refresh
|
||||
|
||||
click_on 'Supprimer'
|
||||
page.accept_alert do
|
||||
click_on 'Supprimer'
|
||||
end
|
||||
expect(page).to have_content('Formulaire enregistré')
|
||||
expect(page).to have_content('Supprimer', count: 1)
|
||||
page.refresh
|
||||
|
|
Loading…
Reference in a new issue