3 namespace Drupal\FunctionalJavascriptTests\Ajax;
5 use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
8 * Tests the Ajax image buttons work with key press events.
12 class AjaxFormImageButtonTest extends JavascriptTestBase {
17 public static $modules = ['ajax_forms_test'];
20 * Tests image buttons can be operated with the keyboard ENTER key.
22 public function testAjaxImageButton() {
23 // Get a Field UI manage-display page.
24 $this->drupalGet('ajax_forms_image_button_form');
25 $assertSession = $this->assertSession();
26 $session = $this->getSession();
28 $enter_key_event = <<<JS
29 jQuery('#edit-image-button')
30 .trigger(jQuery.Event('keypress', {
34 // PhantomJS driver has buggy behavior with key events, we send a JavaScript
36 // @todo: use WebDriver event when we remove PhantomJS driver.
37 $session->executeScript($enter_key_event);
39 $this->assertNotEmpty($assertSession->waitForElementVisible('css', '#ajax-1-more-div'), 'Page updated after image button pressed');