function InlineBlockTestBase::removeInlineBlockFromLayout

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTestBase.php \Drupal\Tests\layout_builder\FunctionalJavascript\InlineBlockTestBase::removeInlineBlockFromLayout()
  2. 8.9.x core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTestBase.php \Drupal\Tests\layout_builder\FunctionalJavascript\InlineBlockTestBase::removeInlineBlockFromLayout()
  3. 10 core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTestBase.php \Drupal\Tests\layout_builder\FunctionalJavascript\InlineBlockTestBase::removeInlineBlockFromLayout()

Removes an entity block from the layout but does not save the layout.

3 calls to InlineBlockTestBase::removeInlineBlockFromLayout()
InlineBlockPrivateFilesTest::testPrivateFiles in core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockPrivateFilesTest.php
Tests access to private files added to inline blocks in the layout builder.
InlineBlockTest::testDeletion in core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php
Tests that entity blocks deleted correctly.
WorkspacesLayoutBuilderIntegrationTest::testBlockDeletionInWorkspaces in core/modules/workspaces/tests/src/FunctionalJavascript/WorkspacesLayoutBuilderIntegrationTest.php
Tests that blocks can be deleted inside workspaces.

File

core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTestBase.php, line 115

Class

InlineBlockTestBase
Base class for testing inline blocks.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

protected function removeInlineBlockFromLayout($selector = NULL) {
    $selector = $selector ?? static::INLINE_BLOCK_LOCATOR;
    $assert_session = $this->assertSession();
    $page = $this->getSession()
        ->getPage();
    $block_text = $page->find('css', $selector)
        ->getText();
    $this->assertNotEmpty($block_text);
    $assert_session->pageTextContains($block_text);
    $this->clickContextualLink($selector, 'Remove block');
    $assert_session->waitForElement('css', "#drupal-off-canvas input[value='Remove']");
    $assert_session->assertWaitOnAjaxRequest();
    // Output the new HTML.
    $this->htmlOutput($page->getHtml());
    $page->find('css', '#drupal-off-canvas')
        ->pressButton('Remove');
    $assert_session->assertNoElementAfterWait('css', '#drupal-off-canvas');
    $assert_session->assertNoElementAfterWait('css', $selector);
    $assert_session->assertWaitOnAjaxRequest();
    $assert_session->pageTextNotContains($block_text);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.