You are here

public function WysiwygSubContext::assertContentNotInWysiwygEditor in Panopoly 8.2

Same name and namespace in other branches
  1. 7 modules/panopoly/panopoly_test/behat/steps/panopoly_test_wysiwyg.behat.inc \WysiwygSubContext::assertContentNotInWysiwygEditor()

Asserts that the given text isn't present in a WYSIWYG editor.

@Then I should not see :text in the :instanceId WYSIWYG editor

File

modules/panopoly/panopoly_test/behat/steps/panopoly_test_wysiwyg.behat.inc, line 278
Provide Behat step-definitions for WYSIWYG editor.

Class

WysiwygSubContext
Behat subcontext for testing WYSIWYG.

Code

public function assertContentNotInWysiwygEditor($text, $instanceId) {
  $instance = $this
    ->getWysiwygInstance($instanceId);
  $content = $this
    ->getSession()
    ->evaluateScript("return {$instance}.getContent()");
  if (strpos($text, $content) !== FALSE) {
    throw new \Exception(sprintf('The text "%s" was found in the "%s" WYSWIYG editor on the page %s', $text, $instanceId, $this
      ->getSession()
      ->getCurrentUrl()));
  }
}