summaryrefslogtreecommitdiff
path: root/test/controllers/admin_controller_test.rb
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-10 02:03:19 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-10 02:03:19 +0200
commit205e6216fc7850fe717122c189e5003d1f9e8afe (patch)
tree8627354f3577f0a974949e759b0e93662840ade7 /test/controllers/admin_controller_test.rb
parent81769557804ce59ce3e4603e8f47e731b61b180d (diff)
Add head/draft/autosave layer comparison at three UI entry points
Node#resolve_page_reference and #available_layer_pairs let Page#diff_against compare named layers (head/draft/autosave), not just numbered revisions -- autosave was never part of Node#pages, so this was the missing piece. Wired into nodes#show's Status section, nodes#edit right after an autosave gets resurrected ("What changed?"), and the admin wizard's current-drafts table, which now also lists autosave-only nodes it previously never showed. revisions#diff hides the numbered-revision picker when comparing named layers (it can't represent them), shows a plain label instead, and offers buttons to switch between whichever other pairs make sense for the node's current state. Destroying the topmost layer is available directly from the diff view, reusing the existing revert! path. "Discard changes" is renamed "Discard Autosave" everywhere it appears, to match "Destroy Draft".
Diffstat (limited to 'test/controllers/admin_controller_test.rb')
-rw-r--r--test/controllers/admin_controller_test.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/test/controllers/admin_controller_test.rb b/test/controllers/admin_controller_test.rb
index 9bbf29b..d6005ba 100644
--- a/test/controllers/admin_controller_test.rb
+++ b/test/controllers/admin_controller_test.rb
@@ -1,8 +1,17 @@
1require 'test_helper' 1require 'test_helper'
2 2
3class AdminControllerTest < ActionController::TestCase 3class AdminControllerTest < ActionController::TestCase
4 # Replace this with your real tests. 4 test "current drafts includes nodes with only an autosave" do
5 test "the truth" do 5 node = Node.root.children.create!(:slug => "admin_autosave_only")
6 assert true 6 node.lock_for_editing!(User.find_by_login("aaron"))
7 node.autosave!({title: "in progress"}, User.find_by_login("aaron"))
8 node.save_draft!(User.find_by_login("aaron"))
9 node.publish_draft!
10 node.lock_for_editing!(User.find_by_login("aaron"))
11 node.autosave!({title: "editing again"}, User.find_by_login("aaron"))
12
13 login_as :quentin
14 get :index
15 assert_includes assigns(:drafts), node
7 end 16 end
8end 17end