function MediaLibraryTestBase::assertSelectedMediaCount

Same name in other branches
  1. 9 core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTestBase::assertSelectedMediaCount()
  2. 8.9.x core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTestBase::assertSelectedMediaCount()
  3. 11.x 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 468

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());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.