function StyleTableTest::testCssTableClass

Tests custom CSS classes are added to table element.

File

core/modules/views/tests/src/Functional/Plugin/StyleTableTest.php, line 253

Class

StyleTableTest
Tests the table style views plugin.

Namespace

Drupal\Tests\views\Functional\Plugin

Code

public function testCssTableClass() : void {
    // Add 2 custom CSS classes separated by a space.
    $view = View::load('test_table');
    $display =& $view->getDisplay('default');
    $display['display_options']['style']['options']['class'] = 'test-css-table-class1 test-css-table-class2';
    $view->save();
    // Ensure all CSS classes are added to table element.
    $this->drupalGet('test-table');
    $this->assertSession()
        ->elementExists('xpath', '//table[contains(concat(" ", @class, " "), " test-css-table-class1 test-css-table-class2 ")]');
}

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