function ContextualLinksTest::assertCorrectContextualLinks

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

Assert the contextual links are correct.

@internal

1 call to ContextualLinksTest::assertCorrectContextualLinks()
ContextualLinksTest::testContextualLinksOutsideLayout in core/modules/layout_builder/tests/src/FunctionalJavascript/ContextualLinksTest.php
Tests that contextual links outside the layout are removed.

File

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

Class

ContextualLinksTest
Test contextual links compatibility with the Layout Builder.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

protected function assertCorrectContextualLinks() {
    $assert_session = $this->assertSession();
    $page = $this->getSession()
        ->getPage();
    $this->assertNotEmpty($assert_session->waitForElementVisible('css', '.block-views-blocktest-block-view-block-2'));
    $assert_session->assertNoElementAfterWait('css', '[data-contextual-id*=\'node:\']');
    // Ensure that the Layout Builder's own contextual links are not removed.
    $this->assertCount(3, $page->findAll('css', '[data-contextual-id*=\'layout_builder_block:\']'));
    // Ensure that the global block's contextual links are removed.
    $assert_session->elementNotExists('css', '[data-contextual-id*=\'block:block=global_block:\']');
}

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