trait WebformWebDriverTestTrait in Webform 6.x
Same name and namespace in other branches
- 8.5 tests/src/Traits/WebformWebDriverTestTrait.php \Drupal\Tests\webform\Traits\WebformWebDriverTestTrait
Provides convenience methods for webform assertions in browser tests.
Hierarchy
- trait \Drupal\Tests\webform\Traits\WebformWebDriverTestTrait
1 file declares its use of WebformWebDriverTestTrait
- WebformWebDriverTestBase.php in tests/
src/ FunctionalJavascript/ WebformWebDriverTestBase.php
File
- tests/
src/ Traits/ WebformWebDriverTestTrait.php, line 10
Namespace
Drupal\Tests\webform\TraitsView source
trait WebformWebDriverTestTrait {
/**
* Execute jQuery event.
*
* @param string $selector
* Selector to trigger the event on.
* @param string $event_type
* The event type.
* @param array $event_options
* The event options.
*/
public function executeJqueryEvent($selector, $event_type, array $event_options = []) {
$event_options = Json::encode($event_options);
$script = "jQuery('{$selector}').trigger(jQuery.Event('{$event_type}', {$event_options}));";
$this
->getSession()
->executeScript($script);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
WebformWebDriverTestTrait:: |
public | function | Execute jQuery event. |