protected function LayoutBuilderDisableInteractionsTest::getElementVerticalPosition in Drupal 10
Same name and namespace in other branches
- 8 core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderDisableInteractionsTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderDisableInteractionsTest::getElementVerticalPosition()
- 9 core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderDisableInteractionsTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderDisableInteractionsTest::getElementVerticalPosition()
Gets the element position.
Parameters
string $css_selector: The CSS selector of the element.
string $position_type: The position type to get, either 'top' or 'bottom'.
Return value
int The element position.
File
- core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ LayoutBuilderDisableInteractionsTest.php, line 314
Class
- LayoutBuilderDisableInteractionsTest
- Tests the Layout Builder disables interactions of rendered blocks.
Namespace
Drupal\Tests\layout_builder\FunctionalJavascriptCode
protected function getElementVerticalPosition($css_selector, $position_type) {
$this
->assertContains($position_type, [
'top',
'bottom',
], 'Expected position type.');
return (int) $this
->getSession()
->evaluateScript("document.querySelector('{$css_selector}').getBoundingClientRect().{$position_type} + window.pageYOffset");
}