public function MenuUiJavascriptTest::testBlockContextualLinks in Drupal 10
Same name and namespace in other branches
- 8 core/modules/menu_ui/tests/src/FunctionalJavascript/MenuUiJavascriptTest.php \Drupal\Tests\menu_ui\FunctionalJavascript\MenuUiJavascriptTest::testBlockContextualLinks()
- 9 core/modules/menu_ui/tests/src/FunctionalJavascript/MenuUiJavascriptTest.php \Drupal\Tests\menu_ui\FunctionalJavascript\MenuUiJavascriptTest::testBlockContextualLinks()
Tests the contextual links on a menu block.
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\FunctionalJavascriptCode
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()}");
}