You are here

private function LayoutBuilderUiTest::assertHighlightedElement in Drupal 8

Same name and namespace in other branches
  1. 9 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()

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 249

Class

LayoutBuilderUiTest
Tests the Layout Builder UI.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

private function assertHighlightedElement($selector) {
  $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'));
}