function ElementsTableSelectTest::testAdvancedSelect
Same name in other branches
- 8.9.x core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php \Drupal\Tests\system\Functional\Form\ElementsTableSelectTest::testAdvancedSelect()
- 10 core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php \Drupal\Tests\system\Functional\Form\ElementsTableSelectTest::testAdvancedSelect()
- 11.x core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php \Drupal\Tests\system\Functional\Form\ElementsTableSelectTest::testAdvancedSelect()
Tests the #js_select property.
File
-
core/
modules/ system/ tests/ src/ Functional/ Form/ ElementsTableSelectTest.php, line 135
Class
- ElementsTableSelectTest
- Tests the tableselect form element for expected behavior.
Namespace
Drupal\Tests\system\Functional\FormCode
public function testAdvancedSelect() {
// When #multiple = TRUE a Select all checkbox should be displayed by default.
$this->drupalGet('form_test/tableselect/advanced-select/multiple-true-default');
$this->assertSession()
->elementExists('xpath', '//th[@class="select-all"]');
// When #js_select is set to FALSE, a "Select all" checkbox should not be displayed.
$this->drupalGet('form_test/tableselect/advanced-select/multiple-true-no-advanced-select');
$this->assertSession()
->elementNotExists('xpath', '//th[@class="select-all"]');
// A "Select all" checkbox never makes sense when #multiple = FALSE, regardless of the value of #js_select.
$this->drupalGet('form_test/tableselect/advanced-select/multiple-false-default');
$this->assertSession()
->elementNotExists('xpath', '//th[@class="select-all"]');
$this->drupalGet('form_test/tableselect/advanced-select/multiple-false-advanced-select');
$this->assertSession()
->elementNotExists('xpath', '//th[@class="select-all"]');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.