You are here

function ThemeTableTestCase::testThemeTableStickyHeaders in Drupal 7

Tableheader.js provides 'sticky' table headers, and is included by default.

File

modules/simpletest/tests/theme.test, line 184
Tests for the theme API.

Class

ThemeTableTestCase
Unit tests for theme_table().

Code

function testThemeTableStickyHeaders() {
  $header = array(
    'one',
    'two',
    'three',
  );
  $rows = array(
    array(
      1,
      2,
      3,
    ),
    array(
      4,
      5,
      6,
    ),
    array(
      7,
      8,
      9,
    ),
  );
  $this->content = theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
  $js = drupal_add_js();
  $this
    ->assertTrue(isset($js['misc/tableheader.js']), 'tableheader.js was included when $sticky = TRUE.');
  $this
    ->assertRaw('sticky-enabled', 'Table has a class of sticky-enabled when $sticky = TRUE.');
  drupal_static_reset('drupal_add_js');
}