You are here

public function WebformWebDriverTestTrait::executeJqueryEvent in Webform 6.x

Same name and namespace in other branches
  1. 8.5 tests/src/Traits/WebformWebDriverTestTrait.php \Drupal\Tests\webform\Traits\WebformWebDriverTestTrait::executeJqueryEvent()

Execute jQuery event.

Parameters

string $selector: Selector to trigger the event on.

string $event_type: The event type.

array $event_options: The event options.

2 calls to WebformWebDriverTestTrait::executeJqueryEvent()
WebformCardsAjaxJavaScriptTest::testAjax in modules/webform_cards/tests/src/FunctionalJavaScript/WebformCardsAjaxJavaScriptTest.php
Test webform cards ajax.
WebformCardsAutoForwardJavaScriptTest::testAutoForward in modules/webform_cards/tests/src/FunctionalJavaScript/WebformCardsAutoForwardJavaScriptTest.php
Test webform cards auto-forward.

File

tests/src/Traits/WebformWebDriverTestTrait.php, line 22

Class

WebformWebDriverTestTrait
Provides convenience methods for webform assertions in browser tests.

Namespace

Drupal\Tests\webform\Traits

Code

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);
}