public function WysiwygSubContext::iPressTheEnterKeyInTheWysiwygEditor in Panopoly 8.2
Presses a key in the WYSIWYG editor.
@When I press the enter key in the :instanceId WYSIWYG editor
@todo this could be a generic "send a command" step?
File
- modules/
panopoly/ panopoly_test/ behat/ steps/ panopoly_test_wysiwyg.behat.inc, line 164 - Provide Behat step-definitions for WYSIWYG editor.
Class
- WysiwygSubContext
- Behat subcontext for testing WYSIWYG.
Code
public function iPressTheEnterKeyInTheWysiwygEditor($instanceId) {
$editorType = $this
->getEditorType($instanceId);
$instance = $this
->getWysiwygInstance($instanceId);
// Necessary for some WYSIWYG editors (namely, markitup) to be focussed
// before instance.insert() will do anything.
$this
->getSession()
->executeScript("jQuery('#{$instanceId}').focus();");
if ($editorType === 'ckeditor') {
$this
->getSession()
->executeScript("{$instance}.execCommand('enter');");
}
else {
throw new \RuntimeException("Unknown editor '{$editorType}' to send commands to.");
}
}