function TableTest::testThemeTableWithNoStriping

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php \Drupal\KernelTests\Core\Render\Element\TableTest::testThemeTableWithNoStriping()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php \Drupal\KernelTests\Core\Render\Element\TableTest::testThemeTableWithNoStriping()
  3. 11.x 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 93

Class

TableTest
Tests built-in table theme functions.

Namespace

Drupal\KernelTests\Core\Render\Element

Code

public function testThemeTableWithNoStriping() : void {
    $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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.