You are here

public function MenuUiJavascriptTest::testBlockContextualLinks in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/menu_ui/tests/src/FunctionalJavascript/MenuUiJavascriptTest.php \Drupal\Tests\menu_ui\FunctionalJavascript\MenuUiJavascriptTest::testBlockContextualLinks()

Tests the contextual links on a menu block.

1 method overrides MenuUiJavascriptTest::testBlockContextualLinks()
ClaroMenuUiJavascriptTest::testBlockContextualLinks in core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroMenuUiJavascriptTest.php
Intentionally empty method.

File

core/modules/menu_ui/tests/src/FunctionalJavascript/MenuUiJavascriptTest.php, line 40

Class

MenuUiJavascriptTest
Tests custom menu and menu links operations using the UI.

Namespace

Drupal\Tests\menu_ui\FunctionalJavascript

Code

public function testBlockContextualLinks() {
  $this
    ->drupalLogin($this
    ->drupalCreateUser([
    'administer menu',
    'access contextual links',
    'administer blocks',
  ]));
  $menu = $this
    ->addCustomMenu();
  $block = $this
    ->drupalPlaceBlock('system_menu_block:' . $menu
    ->id(), [
    'label' => 'Custom menu',
    'provider' => 'system',
  ]);
  $this
    ->addMenuLink('', '/', $menu
    ->id());
  $this
    ->drupalGet('test-page');

  // Click on 'Configure block' contextual link.
  $this
    ->clickContextualLink("#block-{$block->id()}", 'Configure block');

  // Check that we're on block configuration form.
  $this
    ->assertNotEmpty($this
    ->getSession()
    ->getPage()
    ->findLink('Remove block'));
  $this
    ->drupalGet('test-page');

  // Click on 'Edit menu' contextual link.
  $this
    ->clickContextualLink("#block-{$block->id()}", 'Edit menu');

  // Check that we're on block configuration form.
  $this
    ->assertSession()
    ->pageTextContains("Machine name: {$menu->id()}");
}