$assert_session =
$this->
assertSession();
$assert_session->
pageTextMatches('/The media items? ha(s|ve) been created but ha(s|ve) not yet been saved. Fill in any required fields and save to add (it|them) to the media library./'
);
$assert_session->
elementAttributeContains('css',
$selector, 'aria-label', 'Added media items'
);
$fields =
$this->
assertElementExistsAfterWait('css', '[data-drupal-selector="edit-media-' .
$index . '-fields"]'
);
$assert_session->
elementNotExists('css', '.js-media-library-menu'
);
// Assert extraneous components were removed in
// FileUploadForm::hideExtraSourceFieldComponents().
$assert_session->
elementNotExists('css', '[data-drupal-selector$="preview"]',
$fields);
$assert_session->
buttonNotExists('Remove',
$fields);
$assert_session->
elementNotExists('css', '[data-drupal-selector$="filename"]',
$fields);
} /**
* Asserts that media was not added, i.e. due to a validation error.
*/
protected function assertNoMediaAdded() { // Assert the focus is shifted to the first tabbable element of the add
// form, which should be the source field.
$this->
assertJsCondition('jQuery(tabbable.tabbable(document.getElementById("media-library-add-form-wrapper"))[0]).is(":focus")'
);