You are here

protected function EditModeTest::assertAnnounceLeaveEditMode in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php \Drupal\Tests\contextual\FunctionalJavascript\EditModeTest::assertAnnounceLeaveEditMode()
  2. 9 core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php \Drupal\Tests\contextual\FunctionalJavascript\EditModeTest::assertAnnounceLeaveEditMode()

Assert that the correct message was announced when leaving edit mode.

@internal

File

core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php, line 119

Class

EditModeTest
Tests edit mode.

Namespace

Drupal\Tests\contextual\FunctionalJavascript

Code

protected function assertAnnounceLeaveEditMode() : void {
  $web_assert = $this
    ->assertSession();
  $page = $this
    ->getSession()
    ->getPage();

  // Wait till all the contextual links are hidden.
  $page
    ->waitFor(1, function () use ($page, $web_assert) {
    return empty($page
      ->find('css', '.contextual .trigger.visually-hidden'));
  });
  $web_assert
    ->elementContains('css', static::ANNOUNCE_SELECTOR, 'Tabbing is no longer constrained by the Contextual module.');
  $web_assert
    ->elementNotContains('css', static::ANNOUNCE_SELECTOR, 'Tabbing is constrained to a set of');
}