function MenuLinkDefaultFormTest::testMenuLinkDefaultFormCustomizations

Tests the MenuLinkDefaultForm customizations.

File

core/themes/claro/tests/src/Functional/MenuLinkDefaultFormTest.php, line 38

Class

MenuLinkDefaultFormTest
Tests the MenuLinkDefaultForm customizations.

Namespace

Drupal\Tests\claro\Functional

Code

public function testMenuLinkDefaultFormCustomizations() : void {
    $this->drupalGet('/admin/structure/menu/link/system.admin/edit');
    // Assert the Display Settings details element is placed in the sidebar.
    $this->assertSession()
        ->elementTextEquals('css', '.layout-region--secondary #edit-advanced #edit-menu-link-display-settings summary', 'Display settings');
    // Assert tht form elements are in the expected location.
    $this->assertSession()
        ->elementExists('css', '#edit-menu-link-display-settings .form-item--weight');
    $this->assertSession()
        ->elementExists('css', '#edit-menu-link-display-settings .form-item--expanded');
    // Assert that menu link original values are present.
    $this->assertSession()
        ->fieldValueEquals('weight', 9);
    $this->assertSession()
        ->checkboxNotChecked('Show as expanded');
    $this->submitForm([
        'weight' => 10,
        'expanded' => TRUE,
    ], 'Save');
    // Assert that menu link values are updated.
    $this->drupalGet('/admin/structure/menu/link/system.admin/edit');
    $this->assertSession()
        ->fieldValueEquals('weight', 10);
    $this->assertSession()
        ->checkboxChecked('Show as expanded');
}

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