function ContentPreviewToggleTest::assertOrderInPage
Same name in other branches
- 9 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.
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 146
Class
- ContentPreviewToggleTest
- Tests toggling of content preview.
Namespace
Drupal\Tests\layout_builder\FunctionalJavascriptCode
protected function assertOrderInPage(array $items) {
$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 = ArrayUtils::filter($blocks, function ($block, $key) use ($items) {
$block_text = $block->getText();
return strpos($block_text, $items[$key]) !== FALSE;
}, ArrayUtils::ARRAY_FILTER_USE_BOTH);
$this->assertCount(count($items), $blocks_with_expected_text);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.