Ejemplo n.º 1
0
 /**
  * @param RawTqContext $context
  *   Behat context.
  * @param string $selector
  *   Field selector.
  * @param bool $not
  *   Negate the condition.
  * @param string $expected
  *   Expected value.
  */
 public function __construct(RawTqContext $context, $selector, $not, $expected = '')
 {
     $this->not = (bool) $not;
     $this->context = $context;
     $this->selector = $selector;
     $this->expected = $expected;
     $this->element = $this->context->element('field', $selector);
     $this->value = $this->element->getValue();
     $this->tag = $this->element->getTagName();
 }
Ejemplo n.º 2
0
 /**
  * @param array $arguments
  *   jQuery.fn.datepicker arguments.
  *
  * @return mixed
  *   Result of JS execution.
  */
 private function datePicker(array $arguments)
 {
     return $this->context->executeJsOnElement($this->element, sprintf("return jQuery({{ELEMENT}}).datepicker(%s);", implode(', ', array_map(function ($value) {
         return in_array($value, ['<date>']) ? $this->date : "'{$value}'";
     }, $arguments))));
 }
Ejemplo n.º 3
0
 /**
  * @param string $method
  *   WYSIWYG editor method.
  * @param string $selector
  *   Editor selector.
  * @param array $arguments
  *   Arguments for method of WYSIWYG editor.
  *
  * @throws \Exception
  *   Throws an exception if the editor does not exist.
  *
  * @return string
  *   Result of JS evaluation.
  */
 protected function execute($method, $selector = '', array $arguments = [])
 {
     return $this->context->executeJs("return !object.{$method}(!args);", ['!object' => $this->getInstance($selector), '!args' => substr(drupal_json_encode($arguments), 1, -1)]);
 }