Quick way to add text to a hidden ckeditor field

Posted: 2014-05-15 19:13:07

Since I am not testing ckeditor this is a way to get text into a sometimes required field.

//FeaturesContext.php
    /**
     * @Then /^I fill in wysiwyg on field "([^"]*)" with "([^"]*)"$/
     */
    public function iFillInWysiwygOnFieldWith($arg, $arg2)
    {
        $js = <<<HEREDOC
        jQuery("textarea[name='$arg']").css('visibility', 'visible');
        jQuery("textarea[name='$arg']").show();
HEREDOC;
        $this->getSession()->executeScript($js);
        $this->fillField($arg, $arg2);
    }

This will go into FeaturesContext.php. Then to you test you can pass the name and text to place into the field

    Then I fill in wysiwyg on field "body" with "Project via Test 1"

If you want to test Ckeditor then just look for a class that it applies to your text editor to know it is showing. Otherwise assume it is tested and working if it is there.


Tags:

behat php