You are here

protected function MoveBlockFormTest::assertBlockTable in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/tests/src/FunctionalJavascript/MoveBlockFormTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\MoveBlockFormTest::assertBlockTable()
  2. 10 core/modules/layout_builder/tests/src/FunctionalJavascript/MoveBlockFormTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\MoveBlockFormTest::assertBlockTable()

Asserts the correct block labels appear in the draggable tables.

Parameters

string[] $expected_block_labels: The expected block labels.

3 calls to MoveBlockFormTest::assertBlockTable()
MoveBlockFormTest::moveBlockWithKeyboard in core/modules/layout_builder/tests/src/FunctionalJavascript/MoveBlockFormTest.php
Moves a block in the draggable table.
MoveBlockFormTest::openBodyMoveForm in core/modules/layout_builder/tests/src/FunctionalJavascript/MoveBlockFormTest.php
Open block for the body field.
MoveBlockFormTest::testMoveBlock in core/modules/layout_builder/tests/src/FunctionalJavascript/MoveBlockFormTest.php
Tests moving a block.

File

core/modules/layout_builder/tests/src/FunctionalJavascript/MoveBlockFormTest.php, line 146

Class

MoveBlockFormTest
Tests moving blocks via the form.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

protected function assertBlockTable(array $expected_block_labels) {
  $page = $this
    ->getSession()
    ->getPage();
  $this
    ->assertSession()
    ->assertWaitOnAjaxRequest();
  $block_tds = $page
    ->findAll('css', '.layout-builder-components-table__block-label');
  $this
    ->assertSameSize($block_tds, $expected_block_labels);

  /** @var \Behat\Mink\Element\NodeElement $block_td */
  foreach ($block_tds as $block_td) {
    $this
      ->assertSame(array_shift($expected_block_labels), trim($block_td
      ->getText()));
  }
}