function MoveBlockFormTest::moveBlockWithKeyboard

Same name in other branches
  1. 9 core/modules/layout_builder/tests/src/FunctionalJavascript/MoveBlockFormTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\MoveBlockFormTest::moveBlockWithKeyboard()
  2. 8.9.x core/modules/layout_builder/tests/src/FunctionalJavascript/MoveBlockFormTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\MoveBlockFormTest::moveBlockWithKeyboard()
  3. 11.x core/modules/layout_builder/tests/src/FunctionalJavascript/MoveBlockFormTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\MoveBlockFormTest::moveBlockWithKeyboard()

Moves a block in the draggable table.

Parameters

string $direction: The direction to move the block in the table.

string $block_label: The block label.

array $updated_blocks: The updated blocks order.

1 call to MoveBlockFormTest::moveBlockWithKeyboard()
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 215

Class

MoveBlockFormTest
Tests moving blocks via the form.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

protected function moveBlockWithKeyboard($direction, $block_label, array $updated_blocks) {
    $keys = [
        'up' => 38,
        'down' => 40,
    ];
    $key = $keys[$direction];
    $handle = $this->findRowHandle($block_label);
    $handle->keyDown($key);
    $handle->keyUp($key);
    $handle->blur();
    $this->assertBlockTable($updated_blocks);
}

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