function TableTest::testThemeTableResponsive

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

Class

TableTest
Tests built-in table theme functions.

Namespace

Drupal\KernelTests\Core\Render\Element

Code

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

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