You are here

protected function LayoutBuilderDisableInteractionsTest::assertElementUnclickable in Drupal 8

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

Checks if element is unclickable.

Parameters

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

1 call to LayoutBuilderDisableInteractionsTest::assertElementUnclickable()
LayoutBuilderDisableInteractionsTest::assertLinksFormIframeNotInteractive in core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderDisableInteractionsTest.php
Asserts that forms, links, and iframes in preview are non-interactive.

File

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

Class

LayoutBuilderDisableInteractionsTest
Tests the Layout Builder disables interactions of rendered blocks.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

protected function assertElementUnclickable(NodeElement $element) {
  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
      ->assertStringContainsString('is not clickable at point', $e
      ->getMessage());
  }
}