protected function ThunderJavascriptTestBase::clickDropButton in Thunder 8.5
Same name and namespace in other branches
- 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.2.x 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 250
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
->assertSession()
->assertWaitOnAjaxRequest();
}
$this
->scrollElementInView('[name="' . $fieldName . '"]');
$page
->pressButton($fieldName);
$this
->assertSession()
->assertWaitOnAjaxRequest();
}