function StyleTableTest::testResponsiveMergedColumns

Same name in other branches
  1. 10 core/modules/views/tests/src/Functional/Plugin/StyleTableTest.php \Drupal\Tests\views\Functional\Plugin\StyleTableTest::testResponsiveMergedColumns()

Tests responsive classes and column assigning.

File

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

Class

StyleTableTest
Tests the table style views plugin.

Namespace

Drupal\Tests\views\Functional\Plugin

Code

public function testResponsiveMergedColumns() : void {
    
    /** @var \Drupal\views\ViewEntityInterface $view */
    $view = \Drupal::entityTypeManager()->getStorage('view')
        ->load('test_table');
    // Merge the two job columns together and set the responsive priority on
    // the column that is merged to.
    $display =& $view->getDisplay('default');
    $display['display_options']['style']['options']['columns']['job'] = 'job_1';
    $display['display_options']['style']['options']['info']['job_1']['separator'] = ', ';
    $display['display_options']['style']['options']['info']['job_1']['responsive'] = 'priority-low';
    $view->save();
    // Ensure that both columns are properly combined.
    $this->drupalGet('test-table');
    $this->assertSession()
        ->elementExists('xpath', '//tbody/tr/td[contains(concat(" ", @class, " "), " priority-low views-field views-field-job views-field-job-1 ")]');
    $this->assertSession()
        ->elementExists('xpath', '//tbody/tr/td[contains(., "Drummer, Drummer")]');
}

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