public function TableTest::testThemeTableNoStickyHeaders in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php \Drupal\KernelTests\Core\Render\Element\TableTest::testThemeTableNoStickyHeaders()
- 10 core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php \Drupal\KernelTests\Core\Render\Element\TableTest::testThemeTableNoStickyHeaders()
If $sticky is FALSE, no tableheader.js should be included.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Render/ Element/ TableTest.php, line 43
Class
- TableTest
- Tests built-in table theme functions.
Namespace
Drupal\KernelTests\Core\Render\ElementCode
public function testThemeTableNoStickyHeaders() {
$header = [
'one',
'two',
'three',
];
$rows = [
[
1,
2,
3,
],
[
4,
5,
6,
],
[
7,
8,
9,
],
];
$attributes = [];
$caption = NULL;
$colgroups = [];
$table = [
'#type' => 'table',
'#header' => $header,
'#rows' => $rows,
'#attributes' => $attributes,
'#caption' => $caption,
'#colgroups' => $colgroups,
'#sticky' => FALSE,
];
$this
->render($table);
// Make sure tableheader.js was not attached.
$tableheader = $this
->xpath("//script[contains(@src, 'tableheader.js')]");
$this
->assertCount(0, $tableheader);
$this
->assertNoRaw('sticky-enabled');
}