function FormsElementsTableSelectFunctionalTest::testAdvancedSelect in Drupal 7
Test the #js_select property.
File
- modules/
simpletest/ tests/ form.test, line 962 - Unit tests for the Drupal Form API.
Class
- FormsElementsTableSelectFunctionalTest
- Test the tableselect form element for expected behavior.
Code
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
->assertFieldByXPath('//th[@class="select-all"]', NULL, 'Display a "Select all" checkbox by default when #multiple is TRUE.');
// 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
->assertNoFieldByXPath('//th[@class="select-all"]', NULL, 'Do not display a "Select all" checkbox when #js_select is FALSE.');
// 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
->assertNoFieldByXPath('//th[@class="select-all"]', NULL, 'Do not display a "Select all" checkbox when #multiple is FALSE.');
$this
->drupalGet('form_test/tableselect/advanced-select/multiple-false-advanced-select');
$this
->assertNoFieldByXPath('//th[@class="select-all"]', NULL, 'Do not display a "Select all" checkbox when #multiple is FALSE, even when #js_select is TRUE.');
}