You are here

protected function LayoutBuilderTest::addNewBlock in Block Style Plugins 8.2

Add a block from the Off-Canvas Tray into a Section.

Parameters

string $title: The title of the Block being added.

4 calls to LayoutBuilderTest::addNewBlock()
LayoutBuilderTest::testLayoutBuilderBlockVisibility in tests/src/FunctionalJavascript/LayoutBuilderTest.php
Tests that styles are correctly include/excluded from normal block.
LayoutBuilderTest::testLayoutBuilderCustomBlockVisibility in tests/src/FunctionalJavascript/LayoutBuilderTest.php
Tests that styles are correctly included/excluded from custom blocks.
LayoutBuilderTest::testLayoutBuilderTemplateSet in tests/src/FunctionalJavascript/LayoutBuilderTest.php
Tests that a template being set will work with Layout Builder.
LayoutBuilderTest::testLayoutBuilderUi in tests/src/FunctionalJavascript/LayoutBuilderTest.php
Tests that styles can be applied via Layout Builder.

File

tests/src/FunctionalJavascript/LayoutBuilderTest.php, line 275

Class

LayoutBuilderTest
Layout Builder tests.

Namespace

Drupal\Tests\block_style_plugins\FunctionalJavascript

Code

protected function addNewBlock($title) {
  $assert = $this
    ->assertSession();
  $page = $this
    ->getSession()
    ->getPage();
  $this
    ->clickLink('Add block');
  $assert
    ->assertWaitOnAjaxRequest();
  $this
    ->clickLink($title);
  $assert
    ->assertWaitOnAjaxRequest();
  $page
    ->pressButton('Add block');
  $assert
    ->assertNoElementAfterWait('css', '#drupal-off-canvas');
  $assert
    ->assertWaitOnAjaxRequest();
}