You are here

public function ViewsAggregatorStyleTableTest::testEmptyColumn in Views Aggregator Plus 8

Test that empty columns are hidden when empty_column is set.

File

tests/src/Functional/Plugin/ViewsAggregatorStyleTableTest.php, line 156

Class

ViewsAggregatorStyleTableTest
Tests the views aggregator result table style plugin.

Namespace

Drupal\Tests\views_aggregator\Functional\Plugin

Code

public function testEmptyColumn() {

  // Empty the 'job' data.
  \Drupal::database()
    ->update('views_test_data')
    ->fields([
    'job' => '',
  ])
    ->execute();
  $this
    ->drupalGet('va-test-style-table');

  // Test that only one of the job columns still shows.
  $result = $this
    ->xpath('//thead/tr/th/a[text()="Job"]');
  $this
    ->assertEquals(1, count($result), 'Ensure that empty column header is hidden.');
  $result = $this
    ->xpath('//tbody/tr/td[contains(concat(" ", @class, " "), " views-field-job-1 ")]');
  $this
    ->assertEquals(0, count($result), 'Ensure the empty table cells are hidden.');
}