protected function LayoutBuilderDisableInteractionsTest::addBlock in Drupal 9
Same name and namespace in other branches
- 8 core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderDisableInteractionsTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderDisableInteractionsTest::addBlock()
Adds a block in the Layout Builder.
Parameters
string $block_link_text: The link text to add the block.
string $rendered_locator: The CSS locator to confirm the block was rendered.
1 call to LayoutBuilderDisableInteractionsTest::addBlock()
- LayoutBuilderDisableInteractionsTest::testFormsLinksDisabled in core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ LayoutBuilderDisableInteractionsTest.php - Tests that forms and links are disabled in the Layout Builder preview.
File
- core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ LayoutBuilderDisableInteractionsTest.php, line 149
Class
- LayoutBuilderDisableInteractionsTest
- Tests the Layout Builder disables interactions of rendered blocks.
Namespace
Drupal\Tests\layout_builder\FunctionalJavascriptCode
protected function addBlock($block_link_text, $rendered_locator) {
$assert_session = $this
->assertSession();
$page = $this
->getSession()
->getPage();
// Add a new block.
$this
->assertNotEmpty($assert_session
->waitForElementVisible('css', '#layout-builder a:contains(\'Add block\')'));
$this
->clickLink('Add block');
$this
->assertNotEmpty($assert_session
->waitForElementVisible('css', '#drupal-off-canvas'));
$assert_session
->assertWaitOnAjaxRequest();
$assert_session
->linkExists($block_link_text);
$this
->clickLink($block_link_text);
// Wait for off-canvas dialog to reopen with block form.
$this
->assertNotEmpty($assert_session
->waitForElementVisible('css', ".layout-builder-add-block"));
$assert_session
->assertWaitOnAjaxRequest();
$page
->pressButton('Add block');
// Wait for block form to be rendered in the Layout Builder.
$this
->assertNotEmpty($assert_session
->waitForElement('css', $rendered_locator));
}