function LayoutBuilderTest::testSectionLabels

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTest::testSectionLabels()
  2. 8.9.x 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 577

Class

LayoutBuilderTest
Tests the Layout Builder UI.

Namespace

Drupal\Tests\layout_builder\Functional

Code

public function testSectionLabels() : void {
  $assert_session = $this->assertSession();
  $page = $this->getSession()
    ->getPage();
  $this->drupalLogin($this->drupalCreateUser([
    'configure any layout',
    'administer node display',
  ]));
  $display = LayoutBuilderEntityViewDisplay::load('node.bundle_with_section_field.default');
  $this->enableLayoutBuilder($display);
  $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.