You are here

protected function MediaLibraryTestBase::assertSelectedMediaCount in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTestBase::assertSelectedMediaCount()
  2. 10 core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTestBase::assertSelectedMediaCount()

Asserts the current text of the selected item counter.

Parameters

string $text: The expected text of the counter.

2 calls to MediaLibraryTestBase::assertSelectedMediaCount()
EntityReferenceWidgetTest::testWidget in core/modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php
Tests that the Media library's widget works as expected.
MediaLibraryTestBase::selectMediaItem in core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php
Selects an item in the media library modal.

File

core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php, line 448

Class

MediaLibraryTestBase
Base class for functional tests of Media Library functionality.

Namespace

Drupal\Tests\media_library\FunctionalJavascript

Code

protected function assertSelectedMediaCount($text) {
  $selected_count = $this
    ->assertSession()
    ->elementExists('css', '.js-media-library-selected-count');
  $this
    ->assertSame('status', $selected_count
    ->getAttribute('role'));
  $this
    ->assertSame('polite', $selected_count
    ->getAttribute('aria-live'));
  $this
    ->assertSame('true', $selected_count
    ->getAttribute('aria-atomic'));
  $this
    ->assertSame($text, $selected_count
    ->getText());
}