function ContextualLinksTest::assertCorrectContextualLinksInNode

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

Asserts the contextual links are correct on the canonical entity route.

@internal

1 call to ContextualLinksTest::assertCorrectContextualLinksInNode()
ContextualLinksTest::testContextualLinks in core/modules/layout_builder/tests/src/FunctionalJavascript/ContextualLinksTest.php
Tests that the contextual links inside Layout Builder are removed.

File

core/modules/layout_builder/tests/src/FunctionalJavascript/ContextualLinksTest.php, line 142

Class

ContextualLinksTest
Test contextual links compatibility with the Layout Builder.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

protected function assertCorrectContextualLinksInNode() : void {
    $assert_session = $this->assertSession();
    $page = $this->getSession()
        ->getPage();
    $this->assertNotEmpty($assert_session->waitForElementVisible('css', '[data-contextual-id]'));
    // Ensure that no Layout Builder contextual links are visible on node view.
    $this->assertEmpty($page->findAll('css', '[data-contextual-id*=\'layout_builder_block:\']'));
    // Ensure that the contextual links that are hidden in Layout Builder UI
    // are visible on node view.
    $this->assertNotEmpty($page->findAll('css', '.layout-content [data-contextual-id]'));
}

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