You are here

public function VarbaseContext::moveFocusToTheRichTextEditorField in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.8

Same name and namespace in other branches
  1. 8.4 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::moveFocusToTheRichTextEditorField()
  2. 8.5 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::moveFocusToTheRichTextEditorField()
  3. 8.6 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::moveFocusToTheRichTextEditorField()
  4. 8.7 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::moveFocusToTheRichTextEditorField()
  5. 9.0.x tests/features/bootstrap/VarbaseContext.php \VarbaseContext::moveFocusToTheRichTextEditorField()

Move the focus to selected rich text editor field.

Varbase Context #varbase.

Example #1: When I move focus to "Title" rich text editor field Example #2: And I move focus to "Body" rich text editor field.

@When /^(?:|I )move focus to "(?P<selectedField>[^"]*)" rich text editor field$/

File

tests/features/bootstrap/VarbaseContext.php, line 622

Class

VarbaseContext
Defines application features from the specific context.

Code

public function moveFocusToTheRichTextEditorField($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}\"].focus();");
}