// Select a media item, assert the hidden selection field contains the ID of
// the selected item.
$this->
selectMediaItem(0
);
$assert_session->
hiddenFieldValueEquals('media-library-modal-selection', '4'
);
$this->
assertSelectedMediaCount('1 of 1 item selected'
);
$assert_session->
elementNotExists('css', '.js-media-library-menu'
);
$assert_session->
elementExists('css', '.ui-dialog-titlebar-close'
)->
click();
// Assert the menu links can be sorted through the widget configuration.
$this->
openMediaLibraryForField('field_twin_media'
);
$links =
$this->
getTypesMenu()->
findAll('css', 'a'
);
$link_titles =
[];
foreach ($links as $link) { $link_titles[] =
$link->
getText();
} $expected_link_titles =
['Show Type Three media (selected)', 'Show Type One media', 'Show Type Two media', 'Show Type Four media'
];
$this->
assertSame($link_titles,
$expected_link_titles);
$this->
drupalGet('admin/structure/types/manage/basic_page/form-display'
);
// Ensure that the widget settings form is not displayed when only
// one media type is allowed.
$assert_session->
pageTextContains('Single media type'
);