$page->
fillField('Title', 'My page'
);
$this->
openMediaLibraryForField('field_unlimited_media'
);
$page->
checkField('Select Dog'
);
$page->
checkField('Select Cat'
);
$page->
checkField('Select Bear'
);
// Order: Dog - Cat - Bear.
$this->
pressInsertSelected('Added 3 media items.'
);
// Move first item (Dog) to the end.
// Order: Cat - Bear - Dog.
$this->
sortableAfter('[data-media-library-item-delta="0"]', '[data-media-library-item-delta="2"]', '.js-media-library-selection'
);
$wrapper =
$assert_session->
elementExists('css', '.field--name-field-unlimited-media'
);
// Remove second item (Bear).
// Order: Cat - Dog.
$wrapper->
find('css', "[aria-label='Remove Bear']"
)->
press();
$this->
waitForText('Bear has been removed.'
);
$page->
pressButton('Save'
);
$assert_session->
elementTextContains('css', '.field--name-field-unlimited-media > .field__items > .field__item:last-child', 'Dog'
);
}