MDL-43883 Behat: Fix deprecation and move custom matches to the editor field only.
This commit is contained in:
@@ -583,7 +583,11 @@ class behat_base extends Behat\MinkExtension\Context\RawMinkContext {
|
||||
* @return void
|
||||
*/
|
||||
protected function ensure_editors_are_loaded() {
|
||||
debugging('Function behat_base::ensure_editors_are_loaded() is deprecated. It is no longer required.');
|
||||
global $CFG;
|
||||
|
||||
if (empty($CFG->behat_usedeprecated)) {
|
||||
debugging('Function behat_base::ensure_editors_are_loaded() is deprecated. It is no longer required.');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ class behat_field_manager {
|
||||
if ($tagname == 'textarea') {
|
||||
|
||||
// If there is an iframe with $id + _ifr there a TinyMCE editor loaded.
|
||||
$xpath = '//iframe[@id="' . $fieldnode->getAttribute('id') . '_ifr"]';
|
||||
$xpath = '//div[@id="' . $fieldnode->getAttribute('id') . 'editable"]';
|
||||
if ($session->getPage()->find('xpath', $xpath)) {
|
||||
return 'editor';
|
||||
}
|
||||
|
||||
@@ -65,5 +65,15 @@ editor.set("value", "' . $value . '");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Matches the provided value against the current field value.
|
||||
*
|
||||
* @param string $expectedvalue
|
||||
* @return bool The provided value matches the field value?
|
||||
*/
|
||||
public function matches($expectedvalue) {
|
||||
// A text editor may silently wrap the content in p tags (or not). Neither is an error.
|
||||
return $this->text_matches($expectedvalue) || $this->text_matches('<p>' . $expectedvalue . '</p>');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,8 +63,7 @@ class behat_form_text extends behat_form_field {
|
||||
* @return bool The provided value matches the field value?
|
||||
*/
|
||||
public function matches($expectedvalue) {
|
||||
// A text editor may silently wrap the content in p tags (or not). Neither is an error.
|
||||
return $this->text_matches($expectedvalue) || $this->text_matches('<p>' . $expectedvalue . '</p>');
|
||||
return $this->text_matches($expectedvalue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user