You are here

protected function InlineBlockTestBase::removeInlineBlockFromLayout in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTestBase.php \Drupal\Tests\layout_builder\FunctionalJavascript\InlineBlockTestBase::removeInlineBlockFromLayout()
  2. 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.

2 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.

File

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

Class

InlineBlockTestBase
Base class for testing inline blocks.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

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