summaryrefslogtreecommitdiff
path: root/test/models
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-12 02:15:44 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-12 02:15:44 +0200
commit45bf65d04d046c0ea4a1150096b2a9b846d6c0b8 (patch)
tree24dad426779cb3b0ac59c405245aac1d28109982 /test/models
parent13c8cb415813e90c883a44b0c0888382161de92a (diff)
Give the sitemap its own view, with collapse and descendant counts
Extracted from admin#index's inline table into NodesController#sitemap. Nested <details>/<summary> per branch, one linear pass over the existing flat [node, level] list (no added queries) -- each node's own descendant count computed the same way, via a small stack rather than re-walking the tree per node. Branches under updates/, club/erfas, club/chaostreffs, and disclosure start collapsed by default (CccConventions::SITEMAP_COLLAPSED_PATHS); any branch currently collapsed, whether by that default or because someone just closed it, is highlighted via a plain :not([open]) selector -- no state tracked outside the DOM itself. Dropped the update?-post exclusion this view used to rely on -- no longer needed now that updates/ collapses instead of being filtered out, so its real children (previously silently absent) now show up correctly. admin#index's own, separate @sitemap query is unchanged; that view has no collapse mechanism to compensate and wasn't part of this.
Diffstat (limited to 'test/models')
-rw-r--r--test/models/helpers/nodes_helper_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/models/helpers/nodes_helper_test.rb b/test/models/helpers/nodes_helper_test.rb
index 5d91a88..5ab924f 100644
--- a/test/models/helpers/nodes_helper_test.rb
+++ b/test/models/helpers/nodes_helper_test.rb
@@ -22,4 +22,15 @@ class NodesHelperTest < ActionView::TestCase
22 page = FakePage.new([]) 22 page = FakePage.new([])
23 assert_nil default_event_tag_list(page) 23 assert_nil default_event_tag_list(page)
24 end 24 end
25
26 test "sitemap_node_open? is false for a configured collapsed path" do
27 club = Node.root.children.create!(:slug => "club")
28 erfas = club.children.create!(:slug => "erfas")
29 assert_equal false, sitemap_node_open?(erfas)
30 end
31
32 test "sitemap_node_open? is true for anything not configured as collapsed" do
33 node = Node.root.children.create!(:slug => "sitemap_open_test")
34 assert_equal true, sitemap_node_open?(node)
35 end
25end 36end