function ContextualLinksTest::addBlock
Same name in other branches
- 8.9.x core/modules/layout_builder/tests/src/FunctionalJavascript/ContextualLinksTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\ContextualLinksTest::addBlock()
- 10 core/modules/layout_builder/tests/src/FunctionalJavascript/ContextualLinksTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\ContextualLinksTest::addBlock()
- 11.x core/modules/layout_builder/tests/src/FunctionalJavascript/ContextualLinksTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\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.
1 call 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.
File
-
core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ ContextualLinksTest.php, line 103
Class
- ContextualLinksTest
- Test contextual links compatibility with the Layout Builder.
Namespace
Drupal\Tests\layout_builder\FunctionalJavascriptCode
protected function addBlock($block_name) {
$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.