You are here

protected function WysiwygSubContext::getWysiwygInstance in Panopoly 7

Same name and namespace in other branches
  1. 8.2 modules/panopoly/panopoly_test/behat/steps/panopoly_test_wysiwyg.behat.inc \WysiwygSubContext::getWysiwygInstance()

Get the instance variable to use in Javascript.

Parameters

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

Return value

string A Javascript expression representing the WYSIWYG instance.

Throws

Exeception Throws an exception if the editor doesn't exist.

7 calls to WysiwygSubContext::getWysiwygInstance()
WysiwygSubContext::assertContentInWysiwygEditor in modules/panopoly/panopoly_test/behat/steps/panopoly_test_wysiwyg.behat.inc
@Then I should see :text in the :instanceId WYSIWYG editor
WysiwygSubContext::assertContentNotInWysiwygEditor in modules/panopoly/panopoly_test/behat/steps/panopoly_test_wysiwyg.behat.inc
@Then I should not see :text in the :instanceId WYSIWYG editor
WysiwygSubContext::iClickTheButtonInTheWysiwygEditor in modules/panopoly/panopoly_test/behat/steps/panopoly_test_wysiwyg.behat.inc
@When I click the :action button in the :instanceId WYSIWYG editor
WysiwygSubContext::iClickTheElementInTheWysiwygEditor in modules/panopoly/panopoly_test/behat/steps/panopoly_test_wysiwyg.behat.inc
@When I click the :cssSelector element in the :instanceId WYSIWYG editor
WysiwygSubContext::iExpandTheToolbarInTheWysiwygEditor in modules/panopoly/panopoly_test/behat/steps/panopoly_test_wysiwyg.behat.inc
@When I expand the toolbar in the :instanceId WYSIWYG editor

... See full list

File

modules/panopoly/panopoly_test/behat/steps/panopoly_test_wysiwyg.behat.inc, line 41
Provide Behat step-definitions for WYSIWYG editor.

Class

WysiwygSubContext

Code

protected function getWysiwygInstance($instanceId) {
  $instance = "Drupal.wysiwyg.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;
}