function SettingsTrayTestBase::openBlockForm

Same name in other branches
  1. 9 core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php \Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayTestBase::openBlockForm()
  2. 10 core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php \Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayTestBase::openBlockForm()
  3. 11.x core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php \Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayTestBase::openBlockForm()

Open block form by clicking the element found with a css selector.

Parameters

string $block_selector: A css selector selects the block or an element within it.

string $contextual_link_container: The element that contains the contextual links. If none provide the $block_selector will be used.

6 calls to SettingsTrayTestBase::openBlockForm()
ConfigAccessTest::testBlockConfigAccess in core/modules/settings_tray/tests/src/FunctionalJavascript/ConfigAccessTest.php
Tests access to block forms with related configuration is correct.
OverriddenConfigurationTest::testOverriddenBlock in core/modules/settings_tray/tests/src/FunctionalJavascript/OverriddenConfigurationTest.php
Tests that blocks with configuration overrides are disabled.
OverriddenConfigurationTest::testOverriddenConfigurationRemoved in core/modules/settings_tray/tests/src/FunctionalJavascript/OverriddenConfigurationTest.php
Test blocks with overridden related configuration removed when overridden.
QuickEditIntegrationTest::testQuickEditLinks in core/modules/settings_tray/tests/src/FunctionalJavascript/QuickEditIntegrationTest.php
Tests QuickEdit links behavior.
SettingsTrayBlockFormTest::doTestBlocks in core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php
Tests opening off-canvas dialog by click blocks and elements in the blocks.

... See full list

File

core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php, line 39

Class

SettingsTrayTestBase
Base class for Settings Tray tests.

Namespace

Drupal\Tests\settings_tray\FunctionalJavascript

Code

protected function openBlockForm($block_selector, $contextual_link_container = '') {
    if (!$contextual_link_container) {
        $contextual_link_container = $block_selector;
    }
    // Ensure that contextual link element is present because this is required
    // to open the off-canvas dialog in edit mode.
    $contextual_link = $this->assertSession()
        ->waitForElement('css', "{$contextual_link_container} .contextual-links a");
    $this->assertNotEmpty($contextual_link);
    // When page first loads Edit Mode is not triggered until first contextual
    // link is added.
    $this->assertElementVisibleAfterWait('css', '.dialog-off-canvas-main-canvas.js-settings-tray-edit-mode');
    // Ensure that all other Ajax activity is completed.
    $this->assertSession()
        ->assertWaitOnAjaxRequest();
    $block = $this->getSession()
        ->getPage()
        ->find('css', $block_selector);
    $block->mouseOver();
    $block->click();
    $this->waitForOffCanvasToOpen();
    $this->assertOffCanvasBlockFormIsValid();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.