You are here

protected function MoveBlockFormTest::assertBlockTable in Drupal 10

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

@internal

Parameters

string[] $expected_block_labels: The expected block labels.

File

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

Class

MoveBlockFormTest
Tests moving blocks via the form.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

protected function assertBlockTable(array $expected_block_labels) : void {
  $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()));
  }
}