function LayoutBuilderUiTest::assertHighlightedElement

Same name in other branches
  1. 8.9.x core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderUiTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderUiTest::assertHighlightedElement()
  2. 10 core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderUiTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderUiTest::assertHighlightedElement()
  3. 11.x core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderUiTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderUiTest::assertHighlightedElement()

Confirms the presence of the 'is-layout-builder-highlighted' class.

Parameters

string $selector: The highlighted element must also match this selector.

1 call to LayoutBuilderUiTest::assertHighlightedElement()
LayoutBuilderUiTest::testAddHighlights in core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderUiTest.php
Tests that elements that open the dialog are properly highlighted.

File

core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderUiTest.php, line 276

Class

LayoutBuilderUiTest
Tests the Layout Builder UI.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

private function assertHighlightedElement(string $selector) : void {
    $assert_session = $this->assertSession();
    $page = $this->getSession()
        ->getPage();
    // There is only one highlighted element.
    $assert_session->elementsCount('css', '.is-layout-builder-highlighted', 1);
    // The selector is also the highlighted element.
    $this->assertTrue($page->find('css', $selector)
        ->hasClass('is-layout-builder-highlighted'));
}

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