You are here

public function LayoutBuilderTest::testCustomSectionAttributes 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::testCustomSectionAttributes()
  2. 10 core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTest::testCustomSectionAttributes()

Tests that sections can provide custom attributes.

File

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

Class

LayoutBuilderTest
Tests the Layout Builder UI.

Namespace

Drupal\Tests\layout_builder\Functional

Code

public function testCustomSectionAttributes() {
  $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');
  $this
    ->submitForm([
    'layout[enabled]' => TRUE,
  ], 'Save');
  $page
    ->clickLink('Manage layout');
  $page
    ->clickLink('Add section');
  $page
    ->clickLink('Layout Builder Test Plugin');
  $page
    ->pressButton('Add section');

  // See \Drupal\layout_builder_test\Plugin\Layout\LayoutBuilderTestPlugin::build().
  $assert_session
    ->elementExists('css', '.go-birds');
}