Mercurial > hg > cmmr2012-drupal-site
comparison core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children | a9cd425dd02b |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c75dbcec494b |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\FunctionalJavascriptTests\Ajax; | |
4 | |
5 use Drupal\FunctionalJavascriptTests\JavascriptTestBase; | |
6 | |
7 /** | |
8 * Tests the Ajax image buttons work with key press events. | |
9 * | |
10 * @group Ajax | |
11 */ | |
12 class AjaxFormImageButtonTest extends JavascriptTestBase { | |
13 | |
14 /** | |
15 * {@inheritdoc} | |
16 */ | |
17 public static $modules = ['ajax_forms_test']; | |
18 | |
19 /** | |
20 * Tests image buttons can be operated with the keyboard ENTER key. | |
21 */ | |
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(); | |
27 | |
28 $enter_key_event = <<<JS | |
29 jQuery('#edit-image-button') | |
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 | |
39 $this->assertNotEmpty($assertSession->waitForElementVisible('css', '#ajax-1-more-div'), 'Page updated after image button pressed'); | |
40 } | |
41 | |
42 } |