function TableTest::testThemeTableWithNoStriping

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

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.');
}

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