You are here

function TableTest::testThemeTableNoStickyHeaders in Zircon Profile 8

Same name in this branch
  1. 8 core/modules/system/src/Tests/Theme/TableTest.php \Drupal\system\Tests\Theme\TableTest::testThemeTableNoStickyHeaders()
  2. 8 core/modules/system/src/Tests/Render/Element/TableTest.php \Drupal\system\Tests\Render\Element\TableTest::testThemeTableNoStickyHeaders()
Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Render/Element/TableTest.php \Drupal\system\Tests\Render\Element\TableTest::testThemeTableNoStickyHeaders()

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

File

core/modules/system/src/Tests/Render/Element/TableTest.php, line 58
Contains \Drupal\system\Tests\Render\Element\TableTest.

Class

TableTest
Tests built-in table theme functions.

Namespace

Drupal\system\Tests\Render\Element

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();
  $table = array(
    '#type' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#attributes' => $attributes,
    '#caption' => $caption,
    '#colgroups' => $colgroups,
    '#sticky' => FALSE,
  );
  $this
    ->render($table);

  // Make sure tableheader.js was not attached.
  $tableheader = $this
    ->xpath("//script[contains(@src, 'tableheader.js')]");
  $this
    ->assertEqual(count($tableheader), 0);
  $this
    ->assertNoRaw('sticky-enabled');
}