Merge branch 'MDL-82259-main' of https://github.com/aanabit/moodle

This commit is contained in:
Huong Nguyen 2024-07-31 09:17:38 +07:00
commit d11eaeefb9
No known key found for this signature in database
GPG key ID: 40D88AB693A3E72A
11 changed files with 370 additions and 108 deletions

View file

@ -33,10 +33,10 @@ Feature: The module menu replaces the delegated section menu
And I should not see "Assign roles"
And I should not see "Highlight"
And I should see "Edit settings"
# Duplicate, Move and Show/Hide are not implemented yet.
# Duplicate and Move are not implemented yet.
And I should not see "Move"
And I should not see "Duplicate"
And I should not see "Hide"
And I should see "Hide"
# Delete option for subsection page is not implemented yet.
And I should not see "Delete"
And I should see "Permalink"
@ -50,12 +50,11 @@ Feature: The module menu replaces the delegated section menu
And I should not see "Highlight"
And I should see "View"
And I should see "Edit settings"
# Duplicate, Move and Show/Hide are not implemented yet.
# Duplicate and Move are not implemented yet.
And I should not see "Move"
And I should not see "Duplicate"
And I should not see "Hide"
And I should see "Hide"
And I should see "Delete"
And I should see "Permalink"
@javascript
Scenario: The action menu for subsection module in section page has less options than a regular activity
@ -67,10 +66,10 @@ Feature: The module menu replaces the delegated section menu
And I should not see "Highlight"
And I should see "View"
And I should see "Edit settings"
# Duplicate, Move and Show/Hide are not implemented yet.
# Duplicate and Move are not implemented yet.
And I should not see "Move"
And I should not see "Duplicate"
And I should not see "Hide"
And I should see "Hide"
And I should see "Delete"
And I should see "Permalink"
@ -157,3 +156,54 @@ Feature: The module menu replaces the delegated section menu
# Subsection page. Open the section header action menu.
And I click on "Edit" "icon" in the "[data-region='header-actions-container']" "css_element"
And "Delete" "link" should not exist in the "[data-region='header-actions-container']" "css_element"
@javascript
Scenario: Hide/Show option in subsection action menu
Given I turn editing mode on
And I should not see "Hidden from students"
And I open "Subsection1" actions menu
When I choose "Hide" in the open action menu
Then I should see "Hidden from students"
Given I am on the "C1 > Subsection1" "course > section" page
And I should see "Hidden from students"
# Subsection page. Open the section header action menu.
And I click on "Edit" "icon" in the "[data-region='header-actions-container']" "css_element"
And I choose "Show" in the open action menu
And I should not see "Hidden from students"
And I click on "Section 1" "link" in the ".breadcrumb" "css_element"
And I should not see "Hidden from students"
# Section page. Open Subsection1 module action menu.
And I open "Subsection1" actions menu
And I choose "Hide" in the open action menu
And I should see "Hidden from students"
@javascript
Scenario: Hide/Show option in course page action menu for subsections
Given I am on the "C1" "Course" page
And I turn editing mode on
When I hide section "Subsection1"
Then I should see "Hidden from students"
And I show section "Subsection1"
And I should not see "Hidden from students"
@javascript
Scenario: Hide/Show option in subsection page action menu for subsections
Given I am on the "C1 > Subsection1" "course > section" page
And I turn editing mode on
When I hide section "Subsection1"
Then I should see "Hidden from students"
And I show section "Subsection1"
And I should not see "Hidden from students"
@javascript
Scenario: Subsections can't change visibility in hidden sections.
Given I am on the "C1" "Course" page
And I turn editing mode on
And I hide section "Section 1"
When I open section "Subsection1" edit menu
Then I should not see "Hide"
And I should not see "Show"
And I am on the "C1 > Section 1" "course > section" page
And I open section "Subsection1" edit menu
And I should not see "Hide"
And I should not see "Show"

View file

@ -66,7 +66,7 @@ final class sectiondelegate_test extends \advanced_testcase {
// Highlight is only present in section menu (not module), so they shouldn't be found in the result.
// Duplicate is not implemented yet, so they shouldn't be found in the result.
// The possible options are: View, Edit, Delete and Permalink.
// The possible options are: View, Edit, Show, Hide, Delete and Permalink.
if (get_string_manager()->string_exists('editsection', 'format_'.$format->get_format())) {
$streditsection = get_string('editsection', 'format_'.$format->get_format());
} else {
@ -75,9 +75,12 @@ final class sectiondelegate_test extends \advanced_testcase {
$allowedoptions = [
get_string('view'),
$streditsection,
get_string('hidefromothers', 'format_' . $course->format),
get_string('showfromothers', 'format_' . $course->format),
get_string('delete'),
get_string('sectionlink', 'course'),
];
// The default section menu should be different for the delegated section menu.
$result = $delegated->get_section_action_menu($format, $controlmenu, $renderer);
foreach ($result->get_secondary_actions() as $secondaryaction) {