You are here

protected function MoveBlockHelperTrait::moveBlockWithKeyboard in Layout Builder Restrictions 8.2

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.

6 calls to MoveBlockHelperTrait::moveBlockWithKeyboard()
MoveBlockBlacklistTest::testMovePluginBlock in modules/layout_builder_restrictions_by_region/tests/src/FunctionalJavascript/MoveBlockBlacklistTest.php
Tests moving a plugin block.
MoveBlockCategoryRestrictionTest::testMovePluginBlock in modules/layout_builder_restrictions_by_region/tests/src/FunctionalJavascript/MoveBlockCategoryRestrictionTest.php
Tests moving a plugin block.
MoveBlockRestrictionTest::testLayoutLibraryMovePluginBlock in tests/src/FunctionalJavascript/MoveBlockRestrictionTest.php
Move a plugin block in the Layout Library.
MoveBlockRestrictionTest::testMoveContentBlock in tests/src/FunctionalJavascript/MoveBlockRestrictionTest.php
Tests moving a content block.
MoveBlockRestrictionTest::testMovePluginBlock in tests/src/FunctionalJavascript/MoveBlockRestrictionTest.php
Tests moving a plugin block.

... See full list

File

tests/src/Traits/MoveBlockHelperTrait.php, line 56

Class

MoveBlockHelperTrait
General-purpose methods for moving blocks in Layout Builder.

Namespace

Drupal\Tests\layout_builder_restrictions\Traits

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