Merge branch 'MDL-43410-26' of git://github.com/andrewnicols/moodle into MOODLE_26_STABLE

This commit is contained in:
Sam Hemelryk
2013-12-24 09:12:47 +13:00
6 changed files with 61 additions and 5 deletions
@@ -0,0 +1,29 @@
@core @core_course @_cross_browser
Feature: Open the edit menu when a block is docked
In order to edit an activity with a block docked
As a teacher
I need to open the action menu
@javascript
Scenario: Open the action menu with a block docked
Given the following "users" exists:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
And the following "courses" exists:
| fullname | shortname | format |
| Course 1 | C1 | weeks |
And the following "course enrolments" exists:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add a "Glossary" to section "1" and I fill the form with:
| Name | Test glossary name |
| Description | Test glossary description |
And I dock "Navigation" block
When I open "Test glossary name" actions menu
Then "Test glossary name" actions menu should be open
And I reload the page
When I open "Test glossary name" actions menu
Then "Test glossary name" actions menu should be open
+24
View File
@@ -643,6 +643,30 @@ class behat_course extends behat_base {
return new Given('I click on "a[role=\'menuitem\']" "css_element" in the "' . $this->escape($activityname) . '" activity');
}
/**
* Checks that the specified activity's action menu is open.
*
* @Then /^"(?P<activity_name_string>(?:[^"]|\\")*)" actions menu should be open$/
* @throws DriverException The step is not available when Javascript is disabled
* @param string $activityname
* @return Given
*/
public function actions_menu_should_be_open($activityname) {
if (!$this->running_javascript()) {
throw new DriverException('Activities actions menu not available when Javascript is disabled');
}
// If it is already closed we do nothing.
$activitynode = $this->get_activity_node($activityname);
$classes = array_flip(explode(' ', $activitynode->getAttribute('class')));
if (empty($classes['action-menu-shown'])) {
throw new ExpectationException(sprintf("The action menu for '%s' is not open", $activityname), $this->getSession());
}
return;
}
/**
* Indents to the right the activity or resource specified by it's name. Editing mode should be on.
*
@@ -286,7 +286,8 @@ ACTIONMENU.prototype = {
var menu = e.target.ancestor(SELECTOR.MENU),
menuvisible = (menu.hasClass('show'));
e.preventDefault();
// Prevent event propagation as it will trigger the hideIfOutside event handler in certain situations.
e.halt(true);
this.hideMenu();
if (menuvisible) {
// The menu was visible and the user has clicked to toggle it again.
File diff suppressed because one or more lines are too long
@@ -284,7 +284,8 @@ ACTIONMENU.prototype = {
var menu = e.target.ancestor(SELECTOR.MENU),
menuvisible = (menu.hasClass('show'));
e.preventDefault();
// Prevent event propagation as it will trigger the hideIfOutside event handler in certain situations.
e.halt(true);
this.hideMenu();
if (menuvisible) {
// The menu was visible and the user has clicked to toggle it again.
+2 -1
View File
@@ -284,7 +284,8 @@ ACTIONMENU.prototype = {
var menu = e.target.ancestor(SELECTOR.MENU),
menuvisible = (menu.hasClass('show'));
e.preventDefault();
// Prevent event propagation as it will trigger the hideIfOutside event handler in certain situations.
e.halt(true);
this.hideMenu();
if (menuvisible) {
// The menu was visible and the user has clicked to toggle it again.