You are here

protected function MediaLibraryTestBase::pressInsertSelected in Drupal 9

Same name and namespace in other branches
  1. 8 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.

8 calls to MediaLibraryTestBase::pressInsertSelected()
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.
WidgetOEmbedTest::testWidgetOEmbed in core/modules/media_library/tests/src/FunctionalJavascript/WidgetOEmbedTest.php
Tests that oEmbed media can be added in the Media library's widget.
WidgetOEmbedTest::testWidgetOEmbedAdvancedUi in core/modules/media_library/tests/src/FunctionalJavascript/WidgetOEmbedTest.php
Tests that oEmbed media can be added in the widget's advanced UI.

... See full list

File

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

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