getSelectionArea example

'status' => FALSE,
    ]);
    $unpublished_media->save();
    $this->openMediaLibraryForField('field_unlimited_media');
    $this->switchToMediaType('Three');
    // Set the hidden field with the current selection via JavaScript and upload     // a file.     $this->getSession()->executeScript("jQuery('.js-media-library-add-form-current-selection').val('1,2,{$unpublished_media->id()}')");
    $this->addMediaFileToField('Add files', $this->container->get('file_system')->realpath($png_uri_3));
    $this->assertMediaAdded();
    // Assert the pre-selected items are shown.     $this->getSelectionArea();
    // Assert the published items are selected and the unpublished item is not     // selected.     $this->waitForText(Media::load(1)->label());
    $this->waitForText(Media::load(2)->label());
    $assert_session->pageTextNotContains('Mosquito');
    $page->find('css', '.ui-dialog-titlebar-close')->click();

    // Assert we can also remove selected items from the selection area in the     // upload form.     $this->openMediaLibraryForField('field_unlimited_media');
    $this->switchToMediaType('Three');
    
// Assert we can add a oEmbed video with a custom name.     $page->fillField('Add Type Five via URL', $youtube_url);
    $page->pressButton('Add');
    // assertWaitOnAjaxRequest() required for input "id" attributes to     // consistently match their label's "for" attribute.     $assert_session->assertWaitOnAjaxRequest();
    $this->waitForText('The media item has been created but has not yet been saved.');
    // The advanced ui should show the Additional selected media.     $assert_session->pageTextContains('Additional selected media');
    $assert_session->elementExists('css', '[data-drupal-selector="edit-selection"]');
    $page->fillField('Name', 'Custom video title');
    $assert_session->checkboxChecked("Select $youtube_title", $this->getSelectionArea());
    $this->saveAnd('select');
    $this->waitForNoText('Save and select');

    // Load the created media item.     $media_items = Media::loadMultiple();
    $added_media = array_pop($media_items);
    // Ensure the media item was saved to the library and automatically     // selected. The added media items should be in the first position of the     // add form.     $assert_session->pageTextContains('Add or select media');
    $assert_session->pageTextContains('Custom video title');
    
Home | Imprint | This part of the site doesn't use cookies.