You are here

protected function MoveBlockFormTest::moveBlockWithKeyboard 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::moveBlockWithKeyboard()
  2. 10 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 167

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