diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/controllers/nodes_controller_test.rb | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/test/controllers/nodes_controller_test.rb b/test/controllers/nodes_controller_test.rb index c2898cbb..745ae4e0 100644 --- a/test/controllers/nodes_controller_test.rb +++ b/test/controllers/nodes_controller_test.rb | |||
| @@ -631,29 +631,19 @@ class NodesControllerTest < ActionController::TestCase | |||
| 631 | assert_select "h1", "Dezentrale" | 631 | assert_select "h1", "Dezentrale" |
| 632 | end | 632 | end |
| 633 | 633 | ||
| 634 | test "sitemap collapses configured paths but leaves others open" do | 634 | test "sitemap collapses every subtree by default" do |
| 635 | club = Node.root.children.create!(:slug => "club") | 635 | club = Node.root.children.create!(:slug => "club") |
| 636 | erfas = club.children.create!(:slug => "erfas") | 636 | erfas = club.children.create!(:slug => "erfas") |
| 637 | erfas.children.create!(:slug => "one_chapter") | 637 | erfas.children.create!(:slug => "one_chapter") |
| 638 | other = Node.root.children.create!(:slug => "sitemap_controller_open_test") | ||
| 639 | other.children.create!(:slug => "sitemap_controller_open_child") | ||
| 640 | 638 | ||
| 641 | login_as :quentin | 639 | login_as :quentin |
| 642 | get :sitemap | 640 | get :sitemap |
| 643 | assert_response :success | 641 | assert_response :success |
| 644 | 642 | ||
| 645 | doc = Nokogiri::HTML::DocumentFragment.parse(response.body) | 643 | doc = Nokogiri::HTML::DocumentFragment.parse(response.body) |
| 646 | 644 | assert doc.css("details").any?, "expected at least one disclosure" | |
| 647 | erfas_node_div = doc.css('.sitemap_node').find { |div| div.at_css('.node_path')&.text&.include?(erfas.unique_name) } | 645 | assert_empty doc.css("details[open]"), |
| 648 | other_node_div = doc.css('.sitemap_node').find { |div| div.at_css('.node_path')&.text&.include?(other.unique_name) } | 646 | "subtrees are collapsed by default; nothing should be open" |
| 649 | |||
| 650 | erfas_details = erfas_node_div.next_element | ||
| 651 | other_details = other_node_div.next_element | ||
| 652 | |||
| 653 | assert_equal 'details', erfas_details.name | ||
| 654 | assert_equal 'details', other_details.name | ||
| 655 | assert_not erfas_details.key?('open') | ||
| 656 | assert other_details.key?('open') | ||
| 657 | end | 647 | end |
| 658 | 648 | ||
| 659 | test "sitemap shows how many descendants a collapsed branch is hiding" do | 649 | test "sitemap shows how many descendants a collapsed branch is hiding" do |
