protected function SettingsTrayTestBase::openBlockForm in Drupal 10
Same name and namespace in other branches
- 8 core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php \Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayTestBase::openBlockForm()
- 9 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.
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\FunctionalJavascriptCode
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();
}