Created
June 16, 2013 00:01
-
-
Save eliza411/5790114 to your computer and use it in GitHub Desktop.
Step definition for TinyMCE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Use for wysiwyg fields. | |
* | |
* @When /^I enter "([^"]*)" in the "([^"]*)" text field$/ | |
*/ | |
public function iEnterInTheEditor($text, $field) { | |
$page = $this->getSession()->getPage(); | |
if ($field == 'Body' ) { | |
$iframe_selector = '#edit-body-und-0-value_ifr'; | |
} else { | |
$iframe_selector = '#edit-field-' . str_replace(' ', '_', strtolower($field)) . '-und-0-value_ifr'; | |
} | |
$iframe = $page->find('css', $iframe_selector); | |
if(!$iframe) { | |
return new When("I fill in \"$field\" with \"$text\""); | |
} else { | |
$script = "jQuery('iframe$iframe_selector').contents().find('body#tinymce').append('<p>$text</p>')"; | |
$this->getSession()->executeScript($script); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment