protected function ContentPreviewToggleTest::assertOrderInPage in Drupal 9
Same name and namespace in other branches
- 8 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 145
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 = 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);
}