function LayoutBuilderDisableInteractionsTest::assertElementNotClickable

Same name in other branches
  1. 10 core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderDisableInteractionsTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderDisableInteractionsTest::assertElementNotClickable()

Checks if element is not clickable.

@internal

Parameters

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

1 call to LayoutBuilderDisableInteractionsTest::assertElementNotClickable()
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 189

Class

LayoutBuilderDisableInteractionsTest
Tests the Layout Builder disables interactions of rendered blocks.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

protected function assertElementNotClickable(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));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.