You are here

public function LayoutBuilderTest::testSectionLabels in Drupal 9

Same name and namespace in other branches
  1. 8 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 1049

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');
}