Merge branch 'wip-mdl-46061' of git://github.com/rajeshtaneja/moodle

This commit is contained in:
Marina Glancy
2014-06-26 10:26:59 +08:00
2 changed files with 24 additions and 4 deletions
@@ -18,23 +18,23 @@ Feature: Add images to Atto
And I click on "Select this file" "button"
And I set the field "Describe this image" to "It's the Moodle"
# Wait for the page to "settle".
And I wait "2" seconds
And I wait until the page is ready
And the field "Width" matches value "204"
And the field "Height" matches value "61"
And I set the field "Auto size" to "1"
And I set the field "Width" to "2040"
# Trigger blur on the width field.
And I set the field "Alignment" to "Bottom"
And I take focus off "Width" "field"
And the field "Height" matches value "610"
And I set the field "Height" to "61"
# Trigger blur on the height field.
And I set the field "Alignment" to "Bottom"
And I take focus off "Height" "field"
And the field "Width" matches value "204"
And I set the field "Auto size" to "0"
And I set the field "Width" to "123"
And I set the field "Height" to "456"
# Trigger blur on the height field.
And I set the field "Alignment" to "Bottom"
And I take focus off "Height" "field"
And the field "Width" matches value "123"
And the field "Height" matches value "456"
And I click on "Save image" "button"
+20
View File
@@ -282,6 +282,26 @@ class behat_general extends behat_base {
$node->click();
}
/**
* Sets the focus and takes away the focus from an element, generating blur JS event.
*
* @When /^I take focus off "(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)"$/
* @param string $element Element we look for
* @param string $selectortype The type of what we look for
*/
public function i_take_focus_off_field($element, $selectortype) {
if (!$this->running_javascript()) {
throw new ExpectationException('Can\'t take focus off from "' . $element . '" in non-js mode', $this->getSession());
}
// Gets the node based on the requested selector type and locator.
$node = $this->get_selected_node($selectortype, $element);
$this->ensure_node_is_visible($node);
// Ensure element is focused before taking it off.
$node->focus();
$node->blur();
}
/**
* Clicks the specified element and confirms the expected dialogue.
*