Skip to content

Commit

Permalink
Merge branch 'MDL-72555-311' of https://github.com/laurentdavid/moodle
Browse files Browse the repository at this point in the history
…into MOODLE_311_STABLE
  • Loading branch information
junpataleta committed Jun 17, 2022
2 parents 94d025a + a0727a1 commit 57d119a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
5 changes: 3 additions & 2 deletions blocks/site_main_menu/block_site_main_menu.php
Expand Up @@ -153,9 +153,10 @@ function get_content() {
$this->content->icons[] = '';
}

$this->content->footer = $courserenderer->course_section_add_cm_control($course,
if ($this->page->course->id === SITEID) {
$this->content->footer = $courserenderer->course_section_add_cm_control($course,
0, null, array('inblock' => true));

}
return $this->content;
}
}
Expand Down
37 changes: 31 additions & 6 deletions blocks/site_main_menu/tests/behat/add_url.feature
Expand Up @@ -8,12 +8,37 @@ Feature: Add URL to main menu block
Scenario: Add a URL in menu block and ensure it appears
Given I log in as "admin"
And I am on site homepage
And I navigate to "Turn editing on" in current page administration
And I turn editing mode on
And I add the "Main menu" block
When I add a "URL" to section "0" and I fill the form with:
| Name | google |
| Description | gooooooooogle |
| External URL | http://www.google.com |
| id_display | In pop-up |
Then "google" "link" should exist in the "Main menu" "block"
| Name | reference link |
| Description | mooooooooodle |
| External URL | http://www.moodle.com |
| id_display | In pop-up |
Then "reference link" "link" should exist in the "Main menu" "block"
And "Add an activity or resource" "button" should exist in the "Main menu" "block"

@javascript
Scenario: When the "Main Menu" block is displayed throrought the entire site, adding an URL in a course
results in adding it in the course and not in the frontpage
Given the following "course" exists:
| fullname | Course 1 |
| shortname | C1 |
| category | 0 |
And I log in as "admin"
And I am on site homepage
And I turn editing mode on
And I add the "Main menu" block
And I configure the "Main menu" block
And I set the following fields to these values:
| Page contexts | Display throughout the entire site |
And I press "Save changes"
When I am on the "C1" Course page
And I add a "URL" to section "0" and I fill the form with:
| Name | reference link |
| Description | mooooooooodle |
| External URL | http://www.moodle.com |
| Display description on course page | 1 |
| id_display | In pop-up |
Then "reference link" "link" should not exist in the "Main menu" "block"
And I should see "mooooooooodle" in the "region-main" "region"

0 comments on commit 57d119a

Please sign in to comment.