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">
|
<div className="flex justify-start delete">
|
||||||
<button
|
<button
|
||||||
className="button small icon-only danger"
|
className="button small icon-only danger"
|
||||||
onClick={() =>
|
onClick={() => {
|
||||||
dispatch({ type: 'removeTypeDeChamp', params: { typeDeChamp } })
|
if (confirm('Êtes vous sûr de vouloir supprimer ce champ ?'))
|
||||||
}
|
dispatch({
|
||||||
|
type: 'removeTypeDeChamp',
|
||||||
|
params: { typeDeChamp }
|
||||||
|
});
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon icon="trash" title="Supprimer" />
|
<FontAwesomeIcon icon="trash" title="Supprimer" />
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -513,6 +513,7 @@ ActiveRecord::Schema.define(version: 2019_07_17_151228) do
|
||||||
t.boolean "durees_conservation_required", default: true
|
t.boolean "durees_conservation_required", default: true
|
||||||
t.string "path"
|
t.string "path"
|
||||||
t.string "declarative_with_state"
|
t.string "declarative_with_state"
|
||||||
|
t.text "monavis"
|
||||||
t.text "monavis_embed"
|
t.text "monavis_embed"
|
||||||
t.index ["declarative_with_state"], name: "index_procedures_on_declarative_with_state"
|
t.index ["declarative_with_state"], name: "index_procedures_on_declarative_with_state"
|
||||||
t.index ["hidden_at"], name: "index_procedures_on_hidden_at"
|
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
|
end
|
||||||
|
|
||||||
it "Add a new champ" do
|
it "Add a new champ" do
|
||||||
click_on 'Supprimer'
|
page.accept_alert do
|
||||||
|
click_on 'Supprimer'
|
||||||
|
end
|
||||||
|
|
||||||
within '.buttons' do
|
within '.buttons' do
|
||||||
click_on 'Ajouter un champ'
|
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')
|
expect(page).to have_selector('#champ-3-libelle')
|
||||||
|
|
||||||
within '.type-de-champ[data-index="2"]' do
|
within '.type-de-champ[data-index="2"]' do
|
||||||
click_on 'Supprimer'
|
page.accept_alert do
|
||||||
|
click_on 'Supprimer'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(page).not_to have_selector('#champ-3-libelle')
|
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
|
blur
|
||||||
expect(page).to have_content('Formulaire enregistré')
|
expect(page).to have_content('Formulaire enregistré')
|
||||||
page.refresh
|
page.refresh
|
||||||
|
page.accept_alert do
|
||||||
click_on 'Supprimer'
|
click_on 'Supprimer'
|
||||||
|
end
|
||||||
expect(page).to have_content('Formulaire enregistré')
|
expect(page).to have_content('Formulaire enregistré')
|
||||||
expect(page).to have_content('Supprimer', count: 1)
|
expect(page).to have_content('Supprimer', count: 1)
|
||||||
page.refresh
|
page.refresh
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue