mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-74078 core_my: Lock all blocks on the my courses page
This commit is contained in:
parent
a0c6b4a174
commit
a640f43181
4 changed files with 89 additions and 0 deletions
|
@ -58,6 +58,13 @@ $PAGE->blocks->add_region('content');
|
||||||
$PAGE->set_subpage($currentpage->id);
|
$PAGE->set_subpage($currentpage->id);
|
||||||
$PAGE->set_title(get_string('mycourses'));
|
$PAGE->set_title(get_string('mycourses'));
|
||||||
$PAGE->set_heading(get_string('mycourses'));
|
$PAGE->set_heading(get_string('mycourses'));
|
||||||
|
|
||||||
|
// No blocks can be edited on this page (including by managers/admins) because:
|
||||||
|
// - Course overview is a fixed item on the page and cannot be moved/removed.
|
||||||
|
// - We do not want new blocks on the page.
|
||||||
|
// - Only global blocks (if any) should be visible on the site panel, and cannot be moved int othe centre pane.
|
||||||
|
$PAGE->force_lock_all_blocks();
|
||||||
|
|
||||||
// Force the add block out of the default area.
|
// Force the add block out of the default area.
|
||||||
$PAGE->theme->addblockposition = BLOCK_ADDBLOCK_POSITION_CUSTOM;
|
$PAGE->theme->addblockposition = BLOCK_ADDBLOCK_POSITION_CUSTOM;
|
||||||
|
|
||||||
|
|
|
@ -86,3 +86,28 @@ Feature: Run tests over my courses.
|
||||||
And I click on "Manage courses" "link"
|
And I click on "Manage courses" "link"
|
||||||
And I wait to be redirected
|
And I wait to be redirected
|
||||||
And I should see "Manage course categories and courses"
|
And I should see "Manage course categories and courses"
|
||||||
|
|
||||||
|
@javascript
|
||||||
|
Scenario: Admin can see relevant blocks but not add or move them
|
||||||
|
Given I log in as "admin"
|
||||||
|
And I am on site homepage
|
||||||
|
And I turn editing mode on
|
||||||
|
And I add the "Text" block
|
||||||
|
And I configure the "(new text block)" block
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Page contexts | Display throughout the entire site |
|
||||||
|
| Text block title | Text on all pages |
|
||||||
|
| Content | This is visible on all pages |
|
||||||
|
| Default region | Right |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I should see "This is visible on all pages"
|
||||||
|
And "Move Text on all pages block" "button" should exist in the "Text on all pages" "block"
|
||||||
|
When I am on the "My courses" page
|
||||||
|
# Check blocks visible but are "locked" in place.
|
||||||
|
Then "Course overview" "text" should exist in the "region-main" "region"
|
||||||
|
And I should not see "Add a block"
|
||||||
|
And I should see "This is visible on all pages"
|
||||||
|
And "Move Text on all pages block" "button" should not exist in the "Text on all pages" "block"
|
||||||
|
And "Move Course overview block" "button" should not exist in the "Course overview" "block"
|
||||||
|
And I click on "Actions menu" "icon" in the "Course overview" "block"
|
||||||
|
And I should not see "Delete Course overview block"
|
||||||
|
|
30
theme/boost/tests/behat/mycoursesblocks.feature
Normal file
30
theme/boost/tests/behat/mycoursesblocks.feature
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
@javascript @theme_boost
|
||||||
|
Feature: My courses page block layout in Boost theme
|
||||||
|
In order to have a clear and consistent view on the my courses page
|
||||||
|
As a student
|
||||||
|
I need to see the blocks in the expected placement
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the following "users" exist:
|
||||||
|
| username | firstname | lastname | email |
|
||||||
|
| student1 | Student | 1 | student@example.com |
|
||||||
|
And I log in as "admin"
|
||||||
|
And I am on site homepage
|
||||||
|
And I turn editing mode on
|
||||||
|
And I add the "Text" block
|
||||||
|
And I configure the "(new text block)" block
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Page contexts | Display throughout the entire site |
|
||||||
|
| Text block title | Text on all pages |
|
||||||
|
| Content | This is visible on all pages |
|
||||||
|
| Default region | Right |
|
||||||
|
And I press "Save changes"
|
||||||
|
|
||||||
|
Scenario: Student can see relevant blocks with correct placement on my courses page
|
||||||
|
When I log in as "student1"
|
||||||
|
And I am on the "My courses" page
|
||||||
|
Then "Course overview" "text" should exist in the "region-main" "region"
|
||||||
|
And I should see "This is visible on all pages"
|
||||||
|
And I press "Close block drawer"
|
||||||
|
And "Course overview" "text" should exist in the "region-main" "region"
|
||||||
|
And I should not see "This is visible on all pages"
|
27
theme/classic/tests/behat/mycoursesblocks.feature
Normal file
27
theme/classic/tests/behat/mycoursesblocks.feature
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
@javascript @theme_classic
|
||||||
|
Feature: My courses page block layout in Classic theme
|
||||||
|
In order to have a clear and consistent view on the my courses page
|
||||||
|
As a student
|
||||||
|
I need to see the blocks in the expected placement
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the following "users" exist:
|
||||||
|
| username | firstname | lastname | email |
|
||||||
|
| student1 | Student | 1 | student@example.com |
|
||||||
|
And I log in as "admin"
|
||||||
|
And I am on site homepage
|
||||||
|
And I turn editing mode on
|
||||||
|
And I add the "Text" block
|
||||||
|
And I configure the "(new text block)" block
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Page contexts | Display throughout the entire site |
|
||||||
|
| Text block title | Text on all pages |
|
||||||
|
| Content | This is visible on all pages |
|
||||||
|
| Default region | Right |
|
||||||
|
And I press "Save changes"
|
||||||
|
|
||||||
|
Scenario: Student can see relevant blocks with correct placement on my courses page
|
||||||
|
When I log in as "student1"
|
||||||
|
And I am on the "My courses" page
|
||||||
|
Then "Course overview" "text" should exist in the "region-main" "region"
|
||||||
|
And "This is visible on all pages" "text" should exist in the ".columnright" "css_element"
|
Loading…
Add table
Add a link
Reference in a new issue