function LayoutBuilderTest::testSectionLabels

Same name in other branches
  1. 8.9.x core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTest::testSectionLabels()
  2. 10 core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTest::testSectionLabels()
  3. 11.x core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTest::testSectionLabels()

Tests the functionality of custom section labels.

File

core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php, line 1183

Class

LayoutBuilderTest
Tests the Layout Builder UI.

Namespace

Drupal\Tests\layout_builder\Functional

Code

public function testSectionLabels() {
    $assert_session = $this->assertSession();
    $page = $this->getSession()
        ->getPage();
    $this->drupalLogin($this->drupalCreateUser([
        'configure any layout',
        'administer node display',
    ]));
    $this->drupalGet('admin/structure/types/manage/bundle_with_section_field/display/default');
    $page->checkField('layout[enabled]');
    $page->pressButton('Save');
    $page->checkField('layout[allow_custom]');
    $page->pressButton('Save');
    $this->drupalGet('node/1/layout');
    $page->clickLink('Add section');
    $page->clickLink('One column');
    $page->fillField('layout_settings[label]', 'My Cool Section');
    $page->pressButton('Add section');
    $assert_session->pageTextContains('My Cool Section');
    $page->pressButton('Save layout');
    $assert_session->pageTextNotContains('My Cool Section');
}

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