function LayoutBuilderBlocksTest::testFieldBlockPlaceholder
Same name and namespace in other branches
- 11.x core/modules/layout_builder/tests/src/Functional/LayoutBuilderBlocksTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderBlocksTest::testFieldBlockPlaceholder()
Tests the usage of placeholders for empty field blocks.
File
-
core/
modules/ layout_builder/ tests/ src/ Functional/ LayoutBuilderBlocksTest.php, line 256
Class
- LayoutBuilderBlocksTest
- Tests the Layout Builder UI with blocks.
Namespace
Drupal\Tests\layout_builder\FunctionalCode
public function testFieldBlockPlaceholder() : void {
$assert_session = $this->assertSession();
$page = $this->getSession()
->getPage();
$this->drupalLogin($this->drupalCreateUser([
'configure any layout',
'administer node display',
'administer node fields',
]));
$label = 'Field block test';
$field_ui_prefix = 'admin/structure/types/manage/bundle_with_section_field';
$this->fieldUIAddNewField($field_ui_prefix, 'field_block_test', $label, 'string');
$this->drupalGet("{$field_ui_prefix}/display/default");
$this->submitForm([
'layout[enabled]' => TRUE,
], 'Save');
$this->drupalGet("{$field_ui_prefix}/display/default/layout");
$this->clickLink('Add block');
$this->clickLink($label);
$page->fillField('settings[formatter][type]', 'blank');
$page->pressButton('Add block');
$assert_session->pageTextContains("Placeholder for the \"{$label}\" field");
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.