protected function WysiwygSubContext::getWysiwygInstance in Panopoly 8.2
Same name and namespace in other branches
- 7 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
\Exception 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 - Asserts the text in a WYSIWYG editor.
- WysiwygSubContext::assertContentNotInWysiwygEditor in modules/
panopoly/ panopoly_test/ behat/ steps/ panopoly_test_wysiwyg.behat.inc - Asserts that the given text isn't present in a WYSIWYG editor.
- WysiwygSubContext::iClickTheElementInTheWysiwygEditor in modules/
panopoly/ panopoly_test/ behat/ steps/ panopoly_test_wysiwyg.behat.inc - Clicks the given CSS selector in a WYSIWYG editor.
- WysiwygSubContext::iFillInTheWysiwygEditor in modules/
panopoly/ panopoly_test/ behat/ steps/ panopoly_test_wysiwyg.behat.inc - Fills in the WYSIWYG editor with text.
- WysiwygSubContext::iPressTheEnterKeyInTheWysiwygEditor in modules/
panopoly/ panopoly_test/ behat/ steps/ panopoly_test_wysiwyg.behat.inc - Presses a key in the WYSIWYG editor.
File
- modules/
panopoly/ panopoly_test/ behat/ steps/ panopoly_test_wysiwyg.behat.inc, line 29 - Provide Behat step-definitions for WYSIWYG editor.
Class
- WysiwygSubContext
- Behat subcontext for testing WYSIWYG.
Code
protected function getWysiwygInstance($instanceId) {
$editorType = $this
->getEditorType($instanceId);
if ($editorType === 'ckeditor') {
$instance = "CKEDITOR.instances['{$instanceId}']";
}
else {
throw new \Exception("Cannot determine how to get editor instance for '{$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;
}