You are here

private function LayoutBuilderUiTest::assertHighlightedElement in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderUiTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderUiTest::assertHighlightedElement()
  2. 9 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.

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'));
}