function ContentPreviewToggleTest::assertOrderInPage
Same name in other branches
- 8.9.x core/modules/layout_builder/tests/src/FunctionalJavascript/ContentPreviewToggleTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\ContentPreviewToggleTest::assertOrderInPage()
- 10 core/modules/layout_builder/tests/src/FunctionalJavascript/ContentPreviewToggleTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\ContentPreviewToggleTest::assertOrderInPage()
- 11.x core/modules/layout_builder/tests/src/FunctionalJavascript/ContentPreviewToggleTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\ContentPreviewToggleTest::assertOrderInPage()
Asserts that blocks in a given order in the page.
@internal
Parameters
string[] $items: An ordered list of strings that should appear in the blocks.
1 call to ContentPreviewToggleTest::assertOrderInPage()
- ContentPreviewToggleTest::testContentPreviewToggle in core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ ContentPreviewToggleTest.php - Tests the content preview toggle.
File
-
core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ ContentPreviewToggleTest.php, line 148
Class
- ContentPreviewToggleTest
- Tests toggling of content preview.
Namespace
Drupal\Tests\layout_builder\FunctionalJavascriptCode
protected function assertOrderInPage(array $items) : void {
$session = $this->getSession();
$page = $session->getPage();
$blocks = $page->findAll('css', '[data-layout-content-preview-placeholder-label]');
// Filter will only return value if block contains expected text.
$blocks_with_expected_text = array_filter($blocks, function ($block, $key) use ($items) {
$block_text = $block->getText();
return strpos($block_text, $items[$key]) !== FALSE;
}, ARRAY_FILTER_USE_BOTH);
$this->assertSameSize($items, $blocks_with_expected_text);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.