function MoveBlockFormTest::assertBlockTable

Same name and namespace in other branches
  1. 8.9.x 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()
  3. 11.x 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.

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 190

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.