You are here

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

Same name and namespace in other branches
  1. 8.8 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::moveFocusToTheRichTextEditorField()
  2. 8.4 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::moveFocusToTheRichTextEditorField()
  3. 8.5 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()

#vardot : Move the focus to selected rich text editor field.

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 556

Class

VarbaseContext
Defines application features from the specific context.

Code

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();");
}