You are here

public function ContextualLinksTest::testContextualLinks in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/tests/src/FunctionalJavascript/ContextualLinksTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\ContextualLinksTest::testContextualLinks()
  2. 9 core/modules/layout_builder/tests/src/FunctionalJavascript/ContextualLinksTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\ContextualLinksTest::testContextualLinks()

Tests that the contextual links inside Layout Builder are removed.

File

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

Class

ContextualLinksTest
Test contextual links compatibility with the Layout Builder.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

public function testContextualLinks() {
  $page = $this
    ->getSession()
    ->getPage();
  $this
    ->drupalGet('node/1/layout');

  // Add a block that includes an entity contextual link.
  $this
    ->addBlock('Test Block View: Teaser block');

  // Add a block that includes a views contextual link.
  $this
    ->addBlock('Recent content');

  // Ensure the contextual links are correct before the layout is saved.
  $this
    ->assertCorrectContextualLinksInUi();

  // Ensure the contextual links are correct when the Layout Builder is loaded
  // after being saved.
  $page
    ->hasButton('Save layout');
  $page
    ->pressButton('Save layout');
  $this
    ->drupalGet('node/1/layout');
  $this
    ->assertCorrectContextualLinksInUi();
  $this
    ->drupalGet('node/1');
  $this
    ->assertCorrectContextualLinksInNode();
}