protected function WysiwygSubContext::getWysiwygToolbar in Panopoly 7
Same name and namespace in other branches
- 8.2 modules/panopoly/panopoly_test/behat/steps/panopoly_test_wysiwyg.behat.inc \WysiwygSubContext::getWysiwygToolbar()
Get a Mink Element representing the WYSIWYG toolbar.
Parameters
string $instanceId: The instanceId used by the WYSIWYG module to identify the instance.
string $editorType: Identifies the underlying editor (for example, "tinymce").
Return value
\Behat\Mink\Element\NodeElement The toolbar DOM Node.
Throws
Exeception Throws an exception if the toolbar can't be found.
2 calls to WysiwygSubContext::getWysiwygToolbar()
- 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::iExpandTheToolbarInTheWysiwygEditor in modules/
panopoly/ panopoly_test/ behat/ steps/ panopoly_test_wysiwyg.behat.inc - @When I expand the toolbar in the :instanceId WYSIWYG editor
File
- modules/
panopoly/ panopoly_test/ behat/ steps/ panopoly_test_wysiwyg.behat.inc, line 65 - Provide Behat step-definitions for WYSIWYG editor.
Class
Code
protected function getWysiwygToolbar($instanceId, $editorType) {
$driver = $this
->getSession()
->getDriver();
switch ($editorType) {
case 'tinymce':
$toolbarElement = $driver
->find("//div[@id='{$instanceId}_toolbargroup']");
$toolbarElement = !empty($toolbarElement) ? $toolbarElement[0] : NULL;
break;
case 'markitup':
$elementId = 'markItUp' . ucfirst($instanceId);
$toolbarElement = $driver
->find("//div[@id='{$elementId}']//div[@class='markItUpHeader']");
$toolbarElement = !empty($toolbarElement) ? $toolbarElement[0] : NULL;
break;
}
if (!$toolbarElement) {
throw new \Exception(sprintf('Toolbar for editor "%s" was not found on the page %s', $instanceId, $this
->getSession()
->getCurrentUrl()));
}
return $toolbarElement;
}