You are here

protected function LayoutBuilderDisableInteractionsTest::assertElementUnclickable in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderDisableInteractionsTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderDisableInteractionsTest::assertElementUnclickable()
  2. 9 core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderDisableInteractionsTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderDisableInteractionsTest::assertElementUnclickable()

Checks if element is unclickable.

@internal

Parameters

\Behat\Mink\Element\NodeElement $element: Element being checked for.

File

core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderDisableInteractionsTest.php, line 184

Class

LayoutBuilderDisableInteractionsTest
Tests the Layout Builder disables interactions of rendered blocks.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

protected function assertElementUnclickable(NodeElement $element) : void {
  try {
    $element
      ->click();
    $tag_name = $element
      ->getTagName();
    $this
      ->fail(new FormattableMarkup("@tag_name was clickable when it shouldn't have been", [
      '@tag_name' => $tag_name,
    ]));
  } catch (\Exception $e) {
    $this
      ->assertTrue(JSWebAssert::isExceptionNotClickable($e));
  }
}