protected function ThunderJavascriptTestBase::clickDropButton in Thunder 6.2.x
Same name and namespace in other branches
- 8.5 tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::clickDropButton()
- 8.2 tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::clickDropButton()
- 8.3 tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::clickDropButton()
- 8.4 tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::clickDropButton()
- 6.0.x tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::clickDropButton()
- 6.1.x tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::clickDropButton()
Click a button within a dropdown button field.
Parameters
string $fieldName: The [name] attribute of the button to be clicked.
bool $toggle: Whether the dropdown button should be expanded before clicking.
File
- tests/
src/ FunctionalJavascript/ ThunderJavascriptTestBase.php, line 248
Class
- ThunderJavascriptTestBase
- Base class for Thunder Javascript functional tests.
Namespace
Drupal\Tests\thunder\FunctionalJavascriptCode
protected function clickDropButton($fieldName, $toggle = TRUE) {
$page = $this
->getSession()
->getPage();
if ($toggle) {
$toggleButtonXpath = '//ul[.//*[@name="' . $fieldName . '"]]/li[contains(@class,"dropbutton-toggle")]/button';
$toggleButton = $page
->find('xpath', $toggleButtonXpath);
$toggleButton
->click();
$this
->assertWaitOnAjaxRequest();
}
$this
->scrollElementInView('[name="' . $fieldName . '"]');
$page
->pressButton($fieldName);
$this
->assertWaitOnAjaxRequest();
}