Skip to content

Commit

Permalink
MDL-72006 navigation: Reduce max secondary nav items
Browse files Browse the repository at this point in the history
- Part of: MDL-69588
  • Loading branch information
Chocolate-lightning committed Aug 23, 2021
1 parent d677a3b commit d9016d2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/classes/navigation/views/secondary.php
Expand Up @@ -34,7 +34,7 @@ class secondary extends view {
public $headertitle;

/** @var int The maximum limit of navigation nodes displayed in the secondary navigation */
const MAX_DISPLAYED_NAV_NODES = 6;
const MAX_DISPLAYED_NAV_NODES = 5;

/**
* Defines the default structure for the secondary nav in a course context.
Expand Down
16 changes: 10 additions & 6 deletions lib/tests/navigation/views/secondary_test.php
Expand Up @@ -106,7 +106,7 @@ public function test_setting_initialise(string $context, string $expectedfirstno
$assign = $this->getDataGenerator()->create_module('assign', ['course' => $pagecourse->id]);
$cm = get_coursemodule_from_id('assign', $assign->cmid);
$contextrecord = \context_module::instance($cm->id);
$pageurl = new \moodle_url('/mod/assign/view.php', ['id' => $cm->instance]);
$pageurl = new \moodle_url('/mod/assign/view.php', ['id' => $cm->id]);
$PAGE->set_cm($cm);
break;
case 'system':
Expand Down Expand Up @@ -180,7 +180,7 @@ public function test_force_nodes_into_more_menu(array $secondarynavnodesdata, ar
*/
public function test_force_nodes_into_more_menu_provider(): array {
return [
'The total number of navigation nodes exceeds the max display limit (6); ' .
'The total number of navigation nodes exceeds the max display limit (5); ' .
'navnode2 and navnode4 are forced into "more" menu by default.' =>
[
[
Expand All @@ -201,10 +201,11 @@ public function test_force_nodes_into_more_menu_provider(): array {
[
'navnode2',
'navnode4',
'navnode8',
'navnode9',
],
],
'The total number of navigation nodes does not exceed the max display limit (6); ' .
'The total number of navigation nodes does not exceed the max display limit (5); ' .
'navnode2 and navnode4 are forced into "more" menu by default.' =>
[
[
Expand All @@ -223,7 +224,7 @@ public function test_force_nodes_into_more_menu_provider(): array {
'navnode4',
],
],
'The total number of navigation nodes exceeds the max display limit (6); ' .
'The total number of navigation nodes exceeds the max display limit (5); ' .
'no forced navigation nodes into "more" menu by default.' =>
[
[
Expand All @@ -238,11 +239,12 @@ public function test_force_nodes_into_more_menu_provider(): array {
],
[],
[
'navnode6',
'navnode7',
'navnode8',
],
],
'The total number of navigation nodes does not exceed the max display limit (6); ' .
'The total number of navigation nodes does not exceed the max display limit (5); ' .
'no forced navigation nodes into "more" menu by default.' =>
[
[
Expand All @@ -254,7 +256,9 @@ public function test_force_nodes_into_more_menu_provider(): array {
[ 'text' => 'Navigation node 6', 'key' => 'navnode6'],
],
[],
[],
[
'navnode6',
],
],
];
}
Expand Down

0 comments on commit d9016d2

Please sign in to comment.