function ContextualLinksTest::addBlock
Adds block to the layout via Layout Builder's UI.
Parameters
string $block_name: The block name as it appears in the Add block form.
2 calls to ContextualLinksTest::addBlock()
- ContextualLinksTest::testContextualLinks in core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ ContextualLinksTest.php  - Tests that the contextual links inside Layout Builder are removed.
 - ContextualLinksTest::testContextualLinksOutsideLayout in core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ ContextualLinksTest.php  - Tests that contextual links outside the layout are removed.
 
File
- 
              core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ ContextualLinksTest.php, line 135  
Class
- ContextualLinksTest
 - Test contextual links compatibility with the Layout Builder.
 
Namespace
Drupal\Tests\layout_builder\FunctionalJavascriptCode
protected function addBlock($block_name) : void {
  $assert_session = $this->assertSession();
  $page = $this->getSession()
    ->getPage();
  $assert_session->linkExists('Add block');
  $page->clickLink('Add block');
  $assert_session->assertWaitOnAjaxRequest();
  $this->assertNotEmpty($assert_session->waitForElementVisible('css', "#drupal-off-canvas a:contains('{$block_name}')"));
  $page->clickLink($block_name);
  $this->assertNotEmpty($assert_session->waitForElementVisible('css', '[data-drupal-selector=\'edit-actions-submit\']'));
  $page->pressButton('Add block');
  $assert_session->assertNoElementAfterWait('css', '#drupal-off-canvas');
  $assert_session->assertWaitOnAjaxRequest();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.