From ff3fc0566c2f00d4ba1f7418b786765e570f7993 Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Tue, 23 Oct 2018 15:27:13 +0800 Subject: [PATCH 1/3] MDL-62139 output: Menus fixes Change the boost custom behat step to click on a button. Revert the clean templates to unchanged versions. --- theme/boost/tests/behat/behat_theme_boost_behat_action_menu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/theme/boost/tests/behat/behat_theme_boost_behat_action_menu.php b/theme/boost/tests/behat/behat_theme_boost_behat_action_menu.php index 15597921458..c7e536b628b 100644 --- a/theme/boost/tests/behat/behat_theme_boost_behat_action_menu.php +++ b/theme/boost/tests/behat/behat_theme_boost_behat_action_menu.php @@ -39,7 +39,7 @@ class behat_theme_boost_behat_action_menu extends behat_action_menu { public function i_open_the_action_menu_in($element, $selectortype) { // Gets the node based on the requested selector type and locator. - $node = $this->get_node_in_container("css_element", "[role=menuitem][aria-haspopup=true]", $selectortype, $element); + $node = $this->get_node_in_container("css_element", "[role=button][aria-haspopup=true]", $selectortype, $element); // Check if it is not already opened. if ($node->getAttribute('aria-expanded') === 'true') { From c8cd967f486da5714d9535c2ff70d101c311e876 Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Tue, 23 Oct 2018 15:27:34 +0800 Subject: [PATCH 2/3] MDL-62139 output: Revert template changes Revert accessibility changes for menus in standard themes. --- lib/templates/action_menu_link.mustache | 2 +- lib/templates/action_menu_trigger.mustache | 2 +- lib/tests/user_menu_test.php | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/templates/action_menu_link.mustache b/lib/templates/action_menu_link.mustache index 6aae3b80a5c..cec09b71261 100644 --- a/lib/templates/action_menu_link.mustache +++ b/lib/templates/action_menu_link.mustache @@ -32,5 +32,5 @@ {{#icon}}{{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}{{/icon}}{{#showtext}}{{{text}}}{{/showtext}} {{/disabled}} {{#disabled}} - {{#icon}}{{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}{{/icon}}{{{text}}} + {{#icon}}{{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}{{/icon}}{{{text}}} {{/disabled}} diff --git a/lib/templates/action_menu_trigger.mustache b/lib/templates/action_menu_trigger.mustache index bab31932683..fce1a8b7e1f 100644 --- a/lib/templates/action_menu_trigger.mustache +++ b/lib/templates/action_menu_trigger.mustache @@ -27,4 +27,4 @@ "triggerextraclasses": "" } }} -{{{actiontext}}}{{{menutrigger}}}{{#icon}}{{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}{{/icon}}{{#rawicon}}{{{.}}}{{/rawicon}}{{#menutrigger}}{{/menutrigger}} +{{{actiontext}}}{{{menutrigger}}}{{#icon}}{{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}{{/icon}}{{#rawicon}}{{{.}}}{{/rawicon}}{{#menutrigger}}{{/menutrigger}} diff --git a/lib/tests/user_menu_test.php b/lib/tests/user_menu_test.php index 175be4c3990..1e9d2905cb0 100644 --- a/lib/tests/user_menu_test.php +++ b/lib/tests/user_menu_test.php @@ -96,8 +96,7 @@ test $dividercount += 2; // The basic entry count will additionally include the wrapper menu, Dashboard, Profile, Logout and switch roles link. - // On clean theme only, the trigger is also a menuitem. - $entrycount += 5; + $entrycount += 4; $output = $OUTPUT->user_menu($USER); preg_match_all('/]+role="menuitem"[^>]+>/', $output, $results); From 3ed1cec01e0b910b74da4dfd6d16321f4c4e31d2 Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Tue, 23 Oct 2018 16:35:03 +0800 Subject: [PATCH 3/3] MDL-62139 behat: Invalid test If javascript is disabled, we can't open the menu. --- admin/tool/policy/tests/behat/consent.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/tool/policy/tests/behat/consent.feature b/admin/tool/policy/tests/behat/consent.feature index 2caf478bd15..88563462dad 100644 --- a/admin/tool/policy/tests/behat/consent.feature +++ b/admin/tool/policy/tests/behat/consent.feature @@ -420,7 +420,7 @@ Feature: User must accept policy managed by this plugin when logging in and sign # Create new version of the policy document. And I log in as "admin" And I navigate to "Users > Privacy and policies > Manage policies" in site administration - When I follow "Actions" + # Menu is already open because javascript is disabled. Then I should see "View" And I should see "Edit" And I should see "Set status to \"Inactive\""