You are here

protected function FeatureContext::getWysiwygInstance in Open Social 8

Same name and namespace in other branches
  1. 8.2 tests/behat/features/bootstrap/FeatureContext.php \FeatureContext::getWysiwygInstance()

Get the wysiwyg instance variable to use in Javascript.

Parameters

string: The instanceId used by the WYSIWYG module to identify the instance.

Return value

string A Javascript expression representing the WYSIWYG instance.

Throws

Exception Throws an exception if the editor does not exist.

1 call to FeatureContext::getWysiwygInstance()
FeatureContext::iFillInTheWysiwygEditor in tests/behat/features/bootstrap/FeatureContext.php
@When /^I fill in the "([^"]*)" WYSIWYG editor with "([^"]*)"$/

File

tests/behat/features/bootstrap/FeatureContext.php, line 71

Class

FeatureContext
Defines application features from the specific context.

Code

protected function getWysiwygInstance($instanceId) {
  $instance = "CKEDITOR.instances['{$instanceId}']";
  if (!$this
    ->getSession()
    ->evaluateScript("return !!{$instance}")) {
    throw new \Exception(sprintf('The editor "%s" was not found on the page %s', $instanceId, $this
      ->getSession()
      ->getCurrentUrl()));
  }
  return $instance;
}