MDL-43883 Behat: Fix deprecation and move custom matches to the editor field only.

This commit is contained in:
Damyon Wiese
2014-03-27 12:36:37 +08:00
parent 3e469992a1
commit 786ced9925
4 changed files with 17 additions and 4 deletions
+5 -1
View File
@@ -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;
}
+1 -1
View File
@@ -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>');
}
}
+1 -2
View File
@@ -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);
}
}