diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderDisableInteractionsTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderDisableInteractionsTest.php index 8b482a0dae..a486f9ea9f 100644 --- a/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderDisableInteractionsTest.php +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderDisableInteractionsTest.php @@ -237,7 +237,7 @@ protected function assertContextualLinkRetainsMouseup() { $this->assertNotEmpty($body_block); // Get the current Y position of the body block. - $body_block_top_position = $this->getElementVerticalPosition($body_field_selector); + $body_block_top_position = $this->getElementVerticalPosition($body_field_selector, 'top'); $body_block_contextual_link_button = $body_block->find('css', '.trigger'); $this->assertNotEmpty($body_block_contextual_link_button); @@ -261,7 +261,7 @@ protected function assertContextualLinkRetainsMouseup() { $this->movePointerTo('#iframe-that-should-be-disabled'); $new_body_block_bottom_position = $this->getElementVerticalPosition($body_field_selector, 'bottom'); - $iframe_top_position = $this->getElementVerticalPosition('#iframe-that-should-be-disabled'); + $iframe_top_position = $this->getElementVerticalPosition('#iframe-that-should-be-disabled', 'top'); $minimum_distance_mouse_moved = $iframe_top_position - $new_body_block_bottom_position; $this->assertGreaterThan(200, $minimum_distance_mouse_moved, 'The mouse moved at least 200 pixels'); @@ -270,7 +270,7 @@ protected function assertContextualLinkRetainsMouseup() { // position as it was when $body_block_y_position was declared. It will have // moved slightly because the current block being configured will have a // border that was not present when the dialog was not open. - $new_body_block_top_position = $this->getElementVerticalPosition($body_field_selector); + $new_body_block_top_position = $this->getElementVerticalPosition($body_field_selector, 'top'); $distance_body_block_moved = abs($body_block_top_position - $new_body_block_top_position); // Confirm that body moved only slightly compared to the distance the mouse // moved and therefore was not dragged when the mouse moved. @@ -288,7 +288,7 @@ protected function assertContextualLinkRetainsMouseup() { * @return int * The element position. */ - protected function getElementVerticalPosition($css_selector, $position_type = 'top') { + protected function getElementVerticalPosition($css_selector, $position_type) { $this->assertTrue(in_array($position_type, ['top', 'bottom']), 'Expected position type.'); return (int) $this->getSession()->evaluateScript("document.querySelector('$css_selector').getBoundingClientRect().$position_type + window.pageYOffset"); }