function TableTest::testThemeTableNoStickyHeaders

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php \Drupal\KernelTests\Core\Render\Element\TableTest::testThemeTableNoStickyHeaders()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php \Drupal\KernelTests\Core\Render\Element\TableTest::testThemeTableNoStickyHeaders()
  3. 11.x core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php \Drupal\KernelTests\Core\Render\Element\TableTest::testThemeTableNoStickyHeaders()

If $sticky is FALSE, `sticky-header` class should not be included.

File

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

Class

TableTest
Tests built-in table theme functions.

Namespace

Drupal\KernelTests\Core\Render\Element

Code

public function testThemeTableNoStickyHeaders() : void {
    $header = [
        'one',
        'two',
        'three',
    ];
    $rows = [
        [
            1,
            2,
            3,
        ],
        [
            4,
            5,
            6,
        ],
        [
            7,
            8,
            9,
        ],
    ];
    $attributes = [];
    $caption = NULL;
    $colgroups = [];
    $table = [
        '#type' => 'table',
        '#header' => $header,
        '#rows' => $rows,
        '#attributes' => $attributes,
        '#caption' => $caption,
        '#colgroups' => $colgroups,
        '#sticky' => FALSE,
    ];
    $this->render($table);
    $this->assertNoRaw('sticky-header');
}

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