function MediaLibraryTestBase::pressInsertSelected

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

bool $should_close: (optional) TRUE if we expect the modal to be successfully closed.

13 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.
FieldUiIntegrationTest::testFieldUiIntegration in core/modules/media_library/tests/src/FunctionalJavascript/FieldUiIntegrationTest.php
Tests field UI integration for media library widget.

... See full list

File

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

Class

MediaLibraryTestBase
Base class for functional tests of Media Library functionality.

Namespace

Drupal\Tests\media_library\FunctionalJavascript

Code

protected function pressInsertSelected($expected_announcement = NULL, bool $should_close = TRUE) {
    $this->assertSession()
        ->elementExists('css', '.ui-dialog-buttonpane')
        ->pressButton('Insert selected');
    if ($should_close) {
        $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.