You are here

public function TableTest::testThemeTableResponsive in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php \Drupal\KernelTests\Core\Render\Element\TableTest::testThemeTableResponsive()

Tests that the 'responsive-table' class is applied correctly.

File

core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php, line 158

Class

TableTest
Tests built-in table theme functions.

Namespace

Drupal\KernelTests\Core\Render\Element

Code

public function testThemeTableResponsive() {
  $header = [
    'one',
    'two',
    'three',
  ];
  $rows = [
    [
      1,
      2,
      3,
    ],
    [
      4,
      5,
      6,
    ],
    [
      7,
      8,
      9,
    ],
  ];
  $table = [
    '#type' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#responsive' => TRUE,
  ];
  $this
    ->render($table);
  $this
    ->assertRaw('responsive-enabled', 'The responsive-enabled class was printed correctly.');
}