public function VarbaseContext::selectAllTextInTheRichTextEditorField in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.8
Same name and namespace in other branches
- 8.4 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::selectAllTextInTheRichTextEditorField()
- 8.5 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::selectAllTextInTheRichTextEditorField()
- 8.6 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::selectAllTextInTheRichTextEditorField()
- 8.7 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::selectAllTextInTheRichTextEditorField()
- 9.0.x tests/features/bootstrap/VarbaseContext.php \VarbaseContext::selectAllTextInTheRichTextEditorField()
Select all text in selected field input element.
Varbase Context #varbase.
Example #1: When I select all text in "Body" field Example #2: And I select all text in "Body" field.
@When /^(?:|I )select all text in "(?P<selectedField>[^"]*)" rich text editor field$/
File
- tests/
features/ bootstrap/ VarbaseContext.php, line 643
Class
- VarbaseContext
- Defines application features from the specific context.
Code
public function selectAllTextInTheRichTextEditorField($selectedField) {
$el = $this
->getSession()
->getPage()
->findField($selectedField);
$fieldid = $el
->getAttribute('id');
if (empty($fieldid)) {
throw new \Exception('Could not find an id for the rich text editor field : ' . $selectedField);
}
$this
->getSession()
->getDriver()
->evaluateScript("CKEDITOR.instances[\"{$fieldid}\"].execCommand('selectAll', false, null);");
$this
->getSession()
->getDriver()
->evaluateScript("CKEDITOR.instances[\"{$fieldid}\"].forceNextSelectionCheck();");
$this
->getSession()
->getDriver()
->evaluateScript("CKEDITOR.instances[\"{$fieldid}\"].selectionChange();");
}