function TableTest::testThemeTableStickyHeaders in Zircon Profile 8
Same name in this branch
- 8 core/modules/system/src/Tests/Theme/TableTest.php \Drupal\system\Tests\Theme\TableTest::testThemeTableStickyHeaders()
- 8 core/modules/system/src/Tests/Render/Element/TableTest.php \Drupal\system\Tests\Render\Element\TableTest::testThemeTableStickyHeaders()
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Theme/TableTest.php \Drupal\system\Tests\Theme\TableTest::testThemeTableStickyHeaders()
Tableheader.js provides 'sticky' table headers, and is included by default.
File
- core/
modules/ system/ src/ Tests/ Theme/ TableTest.php, line 39 - Contains \Drupal\system\Tests\Theme\TableTest.
Class
- TableTest
- Tests built-in table theme functions.
Namespace
Drupal\system\Tests\ThemeCode
function testThemeTableStickyHeaders() {
$header = array(
'one',
'two',
'three',
);
$rows = array(
array(
1,
2,
3,
),
array(
4,
5,
6,
),
array(
7,
8,
9,
),
);
$table = array(
'#type' => 'table',
'#header' => $header,
'#rows' => $rows,
'#sticky' => TRUE,
);
$this
->render($table);
// Make sure tableheader.js was attached.
$tableheader = $this
->xpath("//script[contains(@src, 'tableheader.js')]");
$this
->assertEqual(count($tableheader), 1);
$this
->assertRaw('sticky-enabled');
}