From 96cf1945a256c8ef825f9b1af81ca8bee751a0b5 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sat, 15 Aug 2026 00:40:49 +0200 Subject: Add test for trashed rows offering restore and refusing restore without live parents --- test/controllers/nodes_controller_test.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test') diff --git a/test/controllers/nodes_controller_test.rb b/test/controllers/nodes_controller_test.rb index c7caeed1..9cedc52d 100644 --- a/test/controllers/nodes_controller_test.rb +++ b/test/controllers/nodes_controller_test.rb @@ -700,6 +700,22 @@ class NodesControllerTest < ActionController::TestCase assert node.reload.in_trash? end + test "a trashed row offers a restore, and refuses when the parent is gone" do + login_as :quentin + parent = Node.root.children.create!(:slug => "restore_parent") + node = parent.children.create!(:slug => "restorable") + node.trash!(users(:quentin)) + + get :trashed + assert_select "form[action=?]", restore_from_trash_node_path(node), count: 1 + assert_select ".disabled_action", count: 0 + + parent.destroy + get :trashed + assert_select "form[action=?]", restore_from_trash_node_path(node), count: 0 + assert_select ".disabled_action", count: 1 + end + test "trashing the Trash node itself is refused" do login_as :quentin -- cgit v1.3