function MediaLibraryTestBase::pressInsertSelected

Same name and namespace in other branches
  1. 8.9.x core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTestBase::pressInsertSelected()
  2. 10 core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTestBase::pressInsertSelected()
  3. 11.x core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTestBase::pressInsertSelected()

Presses the modal's "Insert selected" button.

@todo Consider requiring screen reader assertion every time "Insert selected" is pressed in https://www.drupal.org/project/drupal/issues/3087227.

Parameters

string $expected_announcement: (optional) The expected screen reader announcement once the modal is closed.

10 calls to MediaLibraryTestBase::pressInsertSelected()
EntityReferenceWidgetTest::testAddAfterReordering in core/modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php
Tests that order is correct after re-order and adding another item.
EntityReferenceWidgetTest::testRemoveAfterReordering in core/modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php
Tests that changed order is maintained after removing a selection.
EntityReferenceWidgetTest::testRequiredMediaField in core/modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php
Tests saving a required media library field.
EntityReferenceWidgetTest::testWidget in core/modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php
Tests that the Media library's widget works as expected.
WidgetAnonymousTest::testWidgetAnonymous in core/modules/media_library/tests/src/FunctionalJavascript/WidgetAnonymousTest.php
Tests that the widget works as expected for anonymous users.

... See full list

File

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

Class

MediaLibraryTestBase
Base class for functional tests of Media Library functionality.

Namespace

Drupal\Tests\media_library\FunctionalJavascript

Code

protected function pressInsertSelected($expected_announcement = NULL) {
    $this->assertSession()
        ->elementExists('css', '.ui-dialog-buttonpane')
        ->pressButton('Insert selected');
    $this->waitForNoText('Add or select media');
    if ($expected_announcement) {
        $this->waitForText($expected_announcement);
    }
}

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