diff --git a/lib/classes/navigation/views/primary.php b/lib/classes/navigation/views/primary.php index dd1a48ad443..8af6b459710 100644 --- a/lib/classes/navigation/views/primary.php +++ b/lib/classes/navigation/views/primary.php @@ -106,7 +106,7 @@ class primary extends view { } else if (in_array($this->context->contextlevel, [CONTEXT_COURSE, CONTEXT_MODULE])) { $activekey = 'courses'; } else if (in_array('siteadminnode', $children) && $node = $this->get_site_admin_node()) { - if ($this->context->contextlevel == CONTEXT_COURSECAT || $node->search_for_active_node()) { + if ($this->context->contextlevel == CONTEXT_COURSECAT || $node->search_for_active_node(URL_MATCH_EXACT)) { $activekey = 'siteadminnode'; } } diff --git a/lib/navigationlib.php b/lib/navigationlib.php index 26f01a7deed..1bc6ee6c8ff 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -645,14 +645,15 @@ class navigation_node implements renderable { /** * Searches all children for the best matching active node + * @param int $strength The url match to be made. * @return navigation_node|false */ - public function search_for_active_node() { - if ($this->check_if_active(URL_MATCH_BASE)) { + public function search_for_active_node($strength = URL_MATCH_BASE) { + if ($this->check_if_active($strength)) { return $this; } else { foreach ($this->children as &$child) { - $outcome = $child->search_for_active_node(); + $outcome = $child->search_for_active_node($strength); if ($outcome !== false) { return $outcome; } diff --git a/lib/upgrade.txt b/lib/upgrade.txt index d554dd1c8a4..8a0e6430725 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -171,6 +171,8 @@ value to get the list of blocks that won't be displayed for a theme. MESSAGE_DEFAULT_PERMITTED also deprecated. core_message_get_user_notification_preferences and core_message_get_user_message_preferences Webservice are now returning enabled boolean on components > notifications > processors. loggedin and loggedoff are deprecated but present for backward compatibility. +* A new parameter $strength of type int is added to method search_for_active_node. This parameter would help us to search for the active nodes based on the + $strength passed to it. === 3.11.4 === * A new option dontforcesvgdownload has been added to the $options parameter of the send_file() function. diff --git a/theme/boost/tests/behat/breadcrumb.feature b/theme/boost/tests/behat/breadcrumb.feature new file mode 100644 index 00000000000..7e55c572a8c --- /dev/null +++ b/theme/boost/tests/behat/breadcrumb.feature @@ -0,0 +1,33 @@ +@javascript @theme_boost +Feature: Breadcrumbs navigation + To navigate in boost theme + As an admin user + I should see breadcrumbs + + Scenario: Admin user navigates to site administrations plugins assignment settings + Given I log in as "admin" + When I navigate to "Plugins > Activity modules > Assignment > Assignment settings" in site administration + Then I should see "Activity modules" in the ".breadcrumb" "css_element" + And I should see "Assignment" in the ".breadcrumb" "css_element" + And I should see "Assignment settings" in the ".breadcrumb" "css_element" + + Scenario: Admin user navigates to site adminsitrations plugins assignment feedback offline grading worksheet + Given I log in as "admin" + When I navigate to "Plugins > Activity modules > Assignment > Feedback plugins > Offline grading worksheet" in site administration + Then I should see "Activity modules" in the ".breadcrumb" "css_element" + And I should see "Assignment" in the ".breadcrumb" "css_element" + And I should see "Feedback plugins" in the ".breadcrumb" "css_element" + And I should see "Offline grading worksheet" in the ".breadcrumb" "css_element" + + Scenario: Admin user navigates to site adminsitrations plugins badges manage backpacks page + Given I log in as "admin" + When I navigate to "Badges > Manage backpacks" in site administration + Then I should see "Badges" in the ".breadcrumb" "css_element" + And I should see "Manage backpacks" in the ".breadcrumb" "css_element" + + Scenario: Admin user navigates to site adminsitrations plugins caching memcached page + Given I log in as "admin" + When I navigate to "Plugins > Caching > Cache stores > Memcached" in site administration + Then I should see "Caching" in the ".breadcrumb" "css_element" + Then I should see "Cache stores" in the ".breadcrumb" "css_element" + And I should see "Memcached" in the ".breadcrumb" "css_element"