function 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.
1 call to LayoutBuilderDisableInteractionsTest::getElementVerticalPosition()
- LayoutBuilderDisableInteractionsTest::assertContextualLinkRetainsMouseup in core/modules/ layout_builder/ tests/ src/ FunctionalJavascript/ LayoutBuilderDisableInteractionsTest.php 
- Makes sure contextual links respond to mouseup event.
File
- 
              core/modules/ layout_builder/ tests/ src/ FunctionalJavascript/ LayoutBuilderDisableInteractionsTest.php, line 313 
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");
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
