diff --git a/app/views/admin/legislation/draft_versions/edit.html.erb b/app/views/admin/legislation/draft_versions/edit.html.erb index a9fadfdc8..efdde4e27 100644 --- a/app/views/admin/legislation/draft_versions/edit.html.erb +++ b/app/views/admin/legislation/draft_versions/edit.html.erb @@ -19,6 +19,7 @@ :destroy, @draft_version, method: :delete, + confirm: true, class: "button hollow alert" ) %> diff --git a/app/views/admin/legislation/questions/edit.html.erb b/app/views/admin/legislation/questions/edit.html.erb index c98ce4eaf..ec51522ab 100644 --- a/app/views/admin/legislation/questions/edit.html.erb +++ b/app/views/admin/legislation/questions/edit.html.erb @@ -19,6 +19,7 @@ :destroy, @question, method: :delete, + confirm: true, class: "button hollow alert" ) %> diff --git a/spec/system/admin/legislation/draft_versions_spec.rb b/spec/system/admin/legislation/draft_versions_spec.rb index 2e5f8034e..642a91f58 100644 --- a/spec/system/admin/legislation/draft_versions_spec.rb +++ b/spec/system/admin/legislation/draft_versions_spec.rb @@ -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 diff --git a/spec/system/admin/legislation/questions_spec.rb b/spec/system/admin/legislation/questions_spec.rb index 20c8fb1a7..45b39d088 100644 --- a/spec/system/admin/legislation/questions_spec.rb +++ b/spec/system/admin/legislation/questions_spec.rb @@ -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"