sortableAfter example

// Confirm repositioning blocks works with content preview disabled.     $this->assertOrderInPage([$links_field_placeholder_label$body_field_placeholder_label]);

    $region_content = '.layout__region--content';
    $links_block = "[data-layout-content-preview-placeholder-label='$links_field_placeholder_label']";
    $body_block = "[data-layout-content-preview-placeholder-label='$body_field_placeholder_label']";

    $assert_session->elementExists('css', $links_block . " div");
    $assert_session->elementExists('css', $body_block . " div");

    $this->sortableAfter($links_block$body_block$region_content);
    $assert_session->assertWaitOnAjaxRequest();

    // Check that the drag-triggered rebuild did not trigger content preview.     $assert_session->pageTextNotContains($content_preview_body_text);

    // Check that drag successfully repositioned blocks.     $this->assertOrderInPage([$body_field_placeholder_label$links_field_placeholder_label]);

    // Check if block position maintained after enabling content preview.     $this->assertTrue($page->hasUncheckedField('layout-builder-content-preview'));
    $page->checkField('layout-builder-content-preview');
    
$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');
  }

  
Home | Imprint | This part of the site doesn't use cookies.