mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-43883 Atto behat: Make the set_field js handle atto or simple textarea
This commit is contained in:
parent
f81d318332
commit
b725a0eb19
@ -50,7 +50,15 @@ class behat_form_editor extends behat_form_textarea {
|
||||
|
||||
$editorid = $this->field->getAttribute('id');
|
||||
if ($this->running_javascript()) {
|
||||
$js = 'M.editor_atto.get_editable_node("'.$editorid.'").setHTML("' . $value . '").focus();';
|
||||
$value = addslashes($value);
|
||||
$js = '
|
||||
var editor = M.editor_atto.get_editable_node("'.$editorid.'");
|
||||
if (editor) {
|
||||
editor.setHTML("' . $value . '").focus();
|
||||
} else {
|
||||
editor = Y.one(document.getElementById("'.$editorid.'"));
|
||||
editor.set("value", "' . $value . '");
|
||||
}';
|
||||
$result = $this->session->executeScript($js);
|
||||
} else {
|
||||
parent::set_value($value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user