function ElementsTableSelectTest::testTableSelectColSpan
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php \Drupal\Tests\system\Functional\Form\ElementsTableSelectTest::testTableSelectColSpan()
- 10 core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php \Drupal\Tests\system\Functional\Form\ElementsTableSelectTest::testTableSelectColSpan()
- 11.x core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php \Drupal\Tests\system\Functional\Form\ElementsTableSelectTest::testTableSelectColSpan()
Tests the display when #colspan is set.
File
-
core/
modules/ system/ tests/ src/ Functional/ Form/ ElementsTableSelectTest.php, line 65
Class
- ElementsTableSelectTest
- Tests the tableselect form element for expected behavior.
Namespace
Drupal\Tests\system\Functional\FormCode
public function testTableSelectColSpan() {
$this->drupalGet('form_test/tableselect/colspan');
$this->assertSession()
->pageTextContains('Three', 'Presence of the third column');
$this->assertSession()
->pageTextNotContains('Four', 'Absence of a fourth column');
// There should be three labeled column headers and 1 for the input.
$table_head = $this->xpath('//thead/tr/th');
$this->assertCount(4, $table_head, 'There are four column headers');
// The first two body rows should each have 5 table cells: One for the
// radio, one cell in the first column, one cell in the second column,
// and two cells in the third column which has colspan 2.
for ($i = 0; $i <= 1; $i++) {
$this->assertCount(5, $this->xpath('//tbody/tr[' . ($i + 1) . ']/td'), 'There are five cells in row ' . $i);
}
// The third row should have 3 cells, one for the radio, one spanning the
// first and second column, and a third in column 3 (which has colspan 3).
$this->assertCount(3, $this->xpath('//tbody/tr[3]/td'), 'There are three cells in row 3.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.