You are here

protected function InlineBlockTestBase::removeInlineBlockFromLayout in Drupal 8

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()

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
Test access to private files added via 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 109

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);
}