Mercurial > hg > isophonics-drupal-site
comparison core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | 129ea1e6d783 |
children |
comparison
equal
deleted
inserted
replaced
17:129ea1e6d783 | 18:af1871eacc83 |
---|---|
17 public static $modules = ['ajax_forms_test']; | 17 public static $modules = ['ajax_forms_test']; |
18 | 18 |
19 /** | 19 /** |
20 * Tests image buttons can be operated with the keyboard ENTER key. | 20 * Tests image buttons can be operated with the keyboard ENTER key. |
21 */ | 21 */ |
22 public function testAjaxImageButton() { | 22 public function testAjaxImageButtonKeypressEnter() { |
23 // Get a Field UI manage-display page. | 23 // Get a Field UI manage-display page. |
24 $this->drupalGet('ajax_forms_image_button_form'); | 24 $this->drupalGet('ajax_forms_image_button_form'); |
25 $assertSession = $this->assertSession(); | 25 $assertSession = $this->assertSession(); |
26 $session = $this->getSession(); | 26 $session = $this->getSession(); |
27 | 27 |
28 $enter_key_event = <<<JS | 28 $button = $session->getPage()->findButton('Edit'); |
29 jQuery('#edit-image-button') | 29 $button->keyPress(13); |
30 .trigger(jQuery.Event('keypress', { | |
31 which: 13 | |
32 })); | |
33 JS; | |
34 // PhantomJS driver has buggy behavior with key events, we send a JavaScript | |
35 // key event instead. | |
36 // @todo: use WebDriver event when we remove PhantomJS driver. | |
37 $session->executeScript($enter_key_event); | |
38 | 30 |
39 $this->assertNotEmpty($assertSession->waitForElementVisible('css', '#ajax-1-more-div'), 'Page updated after image button pressed'); | 31 $this->assertNotEmpty($assertSession->waitForElementVisible('css', '#ajax-1-more-div'), 'Page updated after image button pressed'); |
40 } | 32 } |
41 | 33 |
42 } | 34 } |