function ContextualLinkClickTrait::clickContextualLink
Same name and namespace in other branches
- 11.x core/modules/contextual/tests/src/FunctionalJavascript/ContextualLinkClickTrait.php \Drupal\Tests\contextual\FunctionalJavascript\ContextualLinkClickTrait::clickContextualLink()
Clicks a contextual link.
Parameters
string $selector: The selector for the element that contains the contextual link.
string $link_locator: The link id, title, or text.
bool $force_visible: If true then the button will be forced to visible so it can be clicked.
1 call to ContextualLinkClickTrait::clickContextualLink()
- SettingsTrayBlockFormTest::testEditModeEnableDisable in core/
modules/ settings_tray/ tests/ src/ FunctionalJavascript/ SettingsTrayBlockFormTest.php - Tests enabling and disabling Edit Mode.
File
-
core/
modules/ contextual/ tests/ src/ FunctionalJavascript/ ContextualLinkClickTrait.php, line 20
Class
- ContextualLinkClickTrait
- Functions for testing contextual links.
Namespace
Drupal\Tests\contextual\FunctionalJavascriptCode
protected function clickContextualLink($selector, $link_locator, $force_visible = TRUE) {
$page = $this->getSession()
->getPage();
$page->waitFor(10, function () use ($page, $selector) {
return $page->find('css', "{$selector} .contextual-links");
});
if ($force_visible) {
$this->toggleContextualTriggerVisibility($selector);
}
$element = $this->getSession()
->getPage()
->find('css', $selector);
$element->find('css', '.contextual button')
->press();
$element->findLink($link_locator)
->click();
if ($force_visible) {
$this->toggleContextualTriggerVisibility($selector);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.