You are here

public function AjaxFormImageButtonTest::testAjaxImageButtonKeypressEnter in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php \Drupal\FunctionalJavascriptTests\Ajax\AjaxFormImageButtonTest::testAjaxImageButtonKeypressEnter()
  2. 9 core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php \Drupal\FunctionalJavascriptTests\Ajax\AjaxFormImageButtonTest::testAjaxImageButtonKeypressEnter()

Tests image buttons can be operated with the keyboard ENTER key.

File

core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php, line 27

Class

AjaxFormImageButtonTest
Tests the Ajax image buttons work with key press events.

Namespace

Drupal\FunctionalJavascriptTests\Ajax

Code

public function testAjaxImageButtonKeypressEnter() {

  // Get a Field UI manage-display page.
  $this
    ->drupalGet('ajax_forms_image_button_form');
  $assertSession = $this
    ->assertSession();
  $session = $this
    ->getSession();
  $button = $session
    ->getPage()
    ->findButton('Edit');
  $button
    ->keyPress(13);
  $this
    ->assertNotEmpty($assertSession
    ->waitForElementVisible('css', '#ajax-1-more-div'), 'Page updated after image button pressed');
}