You are here

protected function InlineBlockTestBase::configureInlineBlock 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::configureInlineBlock()

Configures an inline block in the Layout Builder.

Parameters

string $old_body: The old body field value.

string $new_body: The new body field value.

string $block_css_locator: The CSS locator to use to select the contextual link.

3 calls to InlineBlockTestBase::configureInlineBlock()
InlineBlockTest::testInlineBlocks in core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php
Tests adding and editing of inline blocks.
InlineBlockTest::testInlineBlocksRevisioning in core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php
Tests entity blocks revisioning.
InlineBlockTest::testNoLayoutSave in core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php
Tests adding a new entity block and then not saving the layout.

File

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

Class

InlineBlockTestBase
Base class for testing inline blocks.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

protected function configureInlineBlock($old_body, $new_body, $block_css_locator = NULL) {
  $block_css_locator = $block_css_locator ?: static::INLINE_BLOCK_LOCATOR;
  $assert_session = $this
    ->assertSession();
  $page = $this
    ->getSession()
    ->getPage();
  $this
    ->clickContextualLink($block_css_locator, 'Configure');
  $textarea = $assert_session
    ->waitForElementVisible('css', '[name="settings[block_form][body][0][value]"]');
  $this
    ->assertNotEmpty($textarea);
  $this
    ->assertSame($old_body, $textarea
    ->getValue());
  $textarea
    ->setValue($new_body);
  $page
    ->pressButton('Update');
  $assert_session
    ->assertNoElementAfterWait('css', '#drupal-off-canvas');
  $assert_session
    ->assertWaitOnAjaxRequest();
  $this
    ->assertDialogClosedAndTextVisible($new_body);
}