function MoveBlockFormTest::assertRegionBlocksOrder
Same name in other branches
- 9 core/modules/layout_builder/tests/src/FunctionalJavascript/MoveBlockFormTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\MoveBlockFormTest::assertRegionBlocksOrder()
- 8.9.x core/modules/layout_builder/tests/src/FunctionalJavascript/MoveBlockFormTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\MoveBlockFormTest::assertRegionBlocksOrder()
- 11.x core/modules/layout_builder/tests/src/FunctionalJavascript/MoveBlockFormTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\MoveBlockFormTest::assertRegionBlocksOrder()
Asserts that blocks are in the correct order for a region.
@internal
Parameters
int $section_delta: The section delta.
string $region: The region.
array $expected_block_selectors: The block selectors.
2 calls to MoveBlockFormTest::assertRegionBlocksOrder()
- MoveBlockFormTest::setUp in core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ MoveBlockFormTest.php - 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 256
Class
- MoveBlockFormTest
- Tests moving blocks via the form.
Namespace
Drupal\Tests\layout_builder\FunctionalJavascriptCode
protected function assertRegionBlocksOrder(int $section_delta, string $region, array $expected_block_selectors) : void {
$page = $this->getSession()
->getPage();
$assert_session = $this->assertSession();
$assert_session->assertWaitOnAjaxRequest();
$assert_session->assertNoElementAfterWait('css', '#drupal-off-canvas');
$region_selector = "[data-layout-delta=\"{$section_delta}\"] [data-region=\"{$region}\"]";
// Get all blocks currently in the region.
$blocks = $page->findAll('css', "{$region_selector} [data-layout-block-uuid]");
$this->assertSameSize($expected_block_selectors, $blocks);
/** @var \Behat\Mink\Element\NodeElement $block */
foreach ($blocks as $block) {
$block_selector = array_shift($expected_block_selectors);
$assert_session->elementsCount('css', "{$region_selector} {$block_selector}", 1);
$expected_block = $page->find('css', "{$region_selector} {$block_selector}");
$this->assertSame($expected_block->getAttribute('data-layout-block-uuid'), $block->getAttribute('data-layout-block-uuid'));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.