function ThemeTableTestCase::testThemeTableNoStickyHeaders in Drupal 7
If $sticky is FALSE, no tableheader.js should be included.
File
- modules/
simpletest/ tests/ theme.test, line 197 - Tests for the theme API.
Class
- ThemeTableTestCase
- Unit tests for theme_table().
Code
function testThemeTableNoStickyHeaders() {
$header = array(
'one',
'two',
'three',
);
$rows = array(
array(
1,
2,
3,
),
array(
4,
5,
6,
),
array(
7,
8,
9,
),
);
$attributes = array();
$caption = NULL;
$colgroups = array();
$this->content = theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => $attributes,
'caption' => $caption,
'colgroups' => $colgroups,
'sticky' => FALSE,
));
$js = drupal_add_js();
$this
->assertFalse(isset($js['misc/tableheader.js']), 'tableheader.js was not included because $sticky = FALSE.');
$this
->assertNoRaw('sticky-enabled', 'Table does not have a class of sticky-enabled because $sticky = FALSE.');
drupal_static_reset('drupal_add_js');
}