function ItemLayoutFieldBlockTest::testAddAjaxBlock
Same name in other branches
- 9 core/modules/layout_builder/tests/src/FunctionalJavascript/ItemLayoutFieldBlockTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\ItemLayoutFieldBlockTest::testAddAjaxBlock()
- 8.9.x core/modules/layout_builder/tests/src/FunctionalJavascript/ItemLayoutFieldBlockTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\ItemLayoutFieldBlockTest::testAddAjaxBlock()
- 11.x core/modules/layout_builder/tests/src/FunctionalJavascript/ItemLayoutFieldBlockTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\ItemLayoutFieldBlockTest::testAddAjaxBlock()
Tests configuring a field block for a user field.
File
-
core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ ItemLayoutFieldBlockTest.php, line 52
Class
- ItemLayoutFieldBlockTest
- Field blocks tests for the override layout.
Namespace
Drupal\Tests\layout_builder\FunctionalJavascriptCode
public function testAddAjaxBlock() : void {
$assert_session = $this->assertSession();
$page = $this->getSession()
->getPage();
// Start by creating a node of type with layout overrides.
$node = $this->createNode([
'type' => 'bundle_with_layout_overrides',
'body' => [
[
'value' => 'The node body',
],
],
]);
$node->save();
// Open single item layout page.
$this->drupalGet('node/1/layout');
// Add a new block.
$this->clickLink('Add block');
$assert_session->assertWaitOnAjaxRequest();
// Validate that only field blocks for layout bundles are present.
$valid_links = $page->findAll('css', 'a[href$="field_block%3Anode%3Abundle_with_layout_overrides%3Abody"]');
$this->assertCount(1, $valid_links);
$invalid_links = $page->findAll('css', 'a[href$="field_block%3Anode%3Afiller_bundle%3Abody"]');
$this->assertCount(0, $invalid_links);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.