From df17bd1354820c484ffc2e0ece2b045d4d0dec61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sun, 31 Mar 2024 18:34:09 +0200 Subject: [PATCH] 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. --- .../admin/site_customization/pages/edit_component.html.erb | 1 + spec/system/admin/site_customization/pages_spec.rb | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/components/admin/site_customization/pages/edit_component.html.erb b/app/components/admin/site_customization/pages/edit_component.html.erb index 6e7650ad3..9b4850cec 100644 --- a/app/components/admin/site_customization/pages/edit_component.html.erb +++ b/app/components/admin/site_customization/pages/edit_component.html.erb @@ -7,6 +7,7 @@ @page, text: t("admin.site_customization.pages.index.delete"), method: :delete, + confirm: true, class: "delete" ) %> <% end %> diff --git a/spec/system/admin/site_customization/pages_spec.rb b/spec/system/admin/site_customization/pages_spec.rb index 6d1f5d841..6192d5632 100644 --- a/spec/system/admin/site_customization/pages_spec.rb +++ b/spec/system/admin/site_customization/pages_spec.rb @@ -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"