function MenuUiJavascriptTest::testBlockContextualLinks

Same name in other branches
  1. 9 core/modules/menu_ui/tests/src/FunctionalJavascript/MenuUiJavascriptTest.php \Drupal\Tests\menu_ui\FunctionalJavascript\MenuUiJavascriptTest::testBlockContextualLinks()
  2. 8.9.x core/modules/menu_ui/tests/src/FunctionalJavascript/MenuUiJavascriptTest.php \Drupal\Tests\menu_ui\FunctionalJavascript\MenuUiJavascriptTest::testBlockContextualLinks()
  3. 10 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 42

Class

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

Namespace

Drupal\Tests\menu_ui\FunctionalJavascript

Code

public function testBlockContextualLinks() : void {
    $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()}");
}

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