Ask confirmation to delete pages from the edit page

We were already doing that when deleting pages from the index page, and
we also ask for confirmation in almost every page in the admin section.
This commit is contained in:
Javi Martín
2024-03-31 18:34:09 +02:00
parent ccf5c81ea9
commit df17bd1354
2 changed files with 4 additions and 1 deletions

View File

@@ -7,6 +7,7 @@
@page,
text: t("admin.site_customization.pages.index.delete"),
method: :delete,
confirm: true,
class: "delete"
) %>
<% end %>

View File

@@ -93,7 +93,9 @@ describe "Admin custom pages", :admin do
custom_page = create(:site_customization_page, title: "An example custom page")
visit edit_admin_site_customization_page_path(custom_page)
click_button "Delete page"
accept_confirm "Are you sure? This action will delete \"An example custom page\" and can't be undone." do
click_button "Delete page"
end
expect(page).not_to have_content "An example custom page"
expect(page).not_to have_content "example-page"