Skip to content

Commit

Permalink
Merge branch 'MDL-73646-master-v2' of https://github.com/sharidas/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Feb 3, 2022
2 parents 02747f0 + 3eda637 commit 4e1a6e6
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/classes/navigation/views/primary.php
Expand Up @@ -106,7 +106,7 @@ private function set_active_node(): void {
} 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';
}
}
Expand Down
7 changes: 4 additions & 3 deletions lib/navigationlib.php
Expand Up @@ -645,14 +645,15 @@ public function find_active_node() {

/**
* 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;
}
Expand Down
2 changes: 2 additions & 0 deletions lib/upgrade.txt
Expand Up @@ -173,6 +173,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.
Expand Down
33 changes: 33 additions & 0 deletions 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"

0 comments on commit 4e1a6e6

Please sign in to comment.