diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/controllers/nodes_controller_test.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/test/controllers/nodes_controller_test.rb b/test/controllers/nodes_controller_test.rb index 27c28cfe..c2898cbb 100644 --- a/test/controllers/nodes_controller_test.rb +++ b/test/controllers/nodes_controller_test.rb | |||
| @@ -644,8 +644,8 @@ class NodesControllerTest < ActionController::TestCase | |||
| 644 | 644 | ||
| 645 | doc = Nokogiri::HTML::DocumentFragment.parse(response.body) | 645 | doc = Nokogiri::HTML::DocumentFragment.parse(response.body) |
| 646 | 646 | ||
| 647 | erfas_node_div = doc.css('.sitemap_node').find { |div| div.at_css('.field_hint')&.text&.include?(erfas.unique_name) } | 647 | erfas_node_div = doc.css('.sitemap_node').find { |div| div.at_css('.node_path')&.text&.include?(erfas.unique_name) } |
| 648 | other_node_div = doc.css('.sitemap_node').find { |div| div.at_css('.field_hint')&.text&.include?(other.unique_name) } | 648 | other_node_div = doc.css('.sitemap_node').find { |div| div.at_css('.node_path')&.text&.include?(other.unique_name) } |
| 649 | 649 | ||
| 650 | erfas_details = erfas_node_div.next_element | 650 | erfas_details = erfas_node_div.next_element |
| 651 | other_details = other_node_div.next_element | 651 | other_details = other_node_div.next_element |
| @@ -667,20 +667,24 @@ class NodesControllerTest < ActionController::TestCase | |||
| 667 | assert_response :success | 667 | assert_response :success |
| 668 | 668 | ||
| 669 | doc = Nokogiri::HTML::DocumentFragment.parse(response.body) | 669 | doc = Nokogiri::HTML::DocumentFragment.parse(response.body) |
| 670 | erfas_node_div = doc.css('.sitemap_node').find { |div| div.at_css('.field_hint')&.text&.include?(erfas.unique_name) } | 670 | erfas_node_div = doc.css('.sitemap_node').find { |div| div.at_css('.node_path')&.text&.include?(erfas.unique_name) } |
| 671 | erfas_details = erfas_node_div.next_element | 671 | erfas_details = erfas_node_div.next_element |
| 672 | 672 | ||
| 673 | assert_equal 'details', erfas_details.name | 673 | assert_equal 'details', erfas_details.name |
| 674 | assert_match I18n.t("nodes.sitemap.descendants", :count => 2), @response.body | 674 | assert_match I18n.t("nodes.sitemap.descendants", :count => 2), @response.body |
| 675 | end | 675 | end |
| 676 | 676 | ||
| 677 | test "sitemap shows Show and Create Child, not Revisions" do | 677 | test "sitemap offers Create Child and Show, not Revisions" do |
| 678 | node = Node.root.children.create!(:slug => "sitemap_actions_test") | 678 | Node.root.children.create!(:slug => "sitemap_actions_test") |
| 679 | login_as :quentin | 679 | login_as :quentin |
| 680 | get :sitemap | 680 | get :sitemap |
| 681 | assert_select ".sitemap_node_actions", :text => /Show/ | 681 | |
| 682 | assert_select ".sitemap_node_actions", :text => /Create Child/ | 682 | assert_select ".sitemap_node .action_grid a[title=?]", |
| 683 | assert_select ".sitemap_node_actions", :text => /Revisions/, :count => 0 | 683 | I18n.t("nodes.sitemap.create_child") |
| 684 | assert_select ".sitemap_node .action_grid a[title=?]", | ||
| 685 | I18n.t("admin.common.show") | ||
| 686 | assert_select ".sitemap_node .action_grid a[title=?]", | ||
| 687 | I18n.t("admin.common.revisions"), :count => 0 | ||
| 684 | end | 688 | end |
| 685 | 689 | ||
| 686 | test "create logs a create NodeAction with path and title" do | 690 | test "create logs a create NodeAction with path and title" do |
