function TableTest::testThemeTableStickyHeaders

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

File

drupal/core/modules/system/lib/Drupal/system/Tests/Theme/TableTest.php, line 27
Definition of Drupal\system\Tests\Theme\TableTest.

Class

TableTest
Unit tests for theme_table().

Namespace

Drupal\system\Tests\Theme

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['core/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');
}