You are here

public function TableTest::testThemeTableWithNoStriping in Drupal 10

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

Tests that the 'no_striping' option works correctly.

File

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

Class

TableTest
Tests built-in table theme functions.

Namespace

Drupal\KernelTests\Core\Render\Element

Code

public function testThemeTableWithNoStriping() {
  $rows = [
    [
      'data' => [
        1,
      ],
      'no_striping' => TRUE,
    ],
  ];
  $table = [
    '#type' => 'table',
    '#rows' => $rows,
  ];
  $this
    ->render($table);
  $this
    ->assertNoRaw('class="odd"', 'Odd/even classes were not added because $no_striping = TRUE.');
  $this
    ->assertNoRaw('no_striping', 'No invalid no_striping HTML attribute was printed.');
}