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"
$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.
*