Ask confirmation to delete drafts and questions

This is similar to what we do in almost every other page of the admin
section.
This commit is contained in:
Javi Martín
2024-03-06 05:00:03 +01:00
parent ecad046a99
commit 5876738369
4 changed files with 9 additions and 2 deletions

View File

@@ -19,6 +19,7 @@
:destroy,
@draft_version,
method: :delete,
confirm: true,
class: "button hollow alert"
) %>
</div>

View File

@@ -19,6 +19,7 @@
:destroy,
@question,
method: :delete,
confirm: true,
class: "button hollow alert"
) %>
</div>

View File

@@ -78,7 +78,10 @@ describe "Admin legislation draft versions", :admin do
version = create(:legislation_draft_version, body: "Version 1")
visit edit_admin_legislation_process_draft_version_path(version.process, version)
click_button "Delete"
accept_confirm("Are you sure? This action will delete \"Version 1\" and can't be undone.") do
click_button "Delete"
end
expect(page).to have_content "Draft deleted successfully"
end

View File

@@ -75,7 +75,9 @@ describe "Admin legislation questions", :admin do
visit edit_admin_legislation_process_question_path(process, question)
click_button "Delete"
accept_confirm("Are you sure? This action will delete \"Question 2\" and can't be undone.") do
click_button "Delete"
end
expect(page).to have_content "Questions"
expect(page).to have_content "Question 1"