You are here

function ThemeTableUnitTest::testThemeTableNoStickyHeaders in SimpleTest 7

If $sticky is FALSE, no tableheader.js should be included.

File

tests/theme.test, line 82
Tests for the theme API.

Class

ThemeTableUnitTest
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']), t('tableheader.js was not included because $sticky = FALSE.'));
  $this
    ->assertNoRaw('sticky-enabled', t('Table does not have a class of sticky-enabled because $sticky = FALSE.'));
  drupal_static_reset('drupal_add_js');
}