public function ViewsAggregatorStyleTableTest::testAccessibilitySettings in Views Aggregator Plus 8
Test table caption/summary.
File
- tests/
src/ Functional/ Plugin/ ViewsAggregatorStyleTableTest.php, line 62
Class
- ViewsAggregatorStyleTableTest
- Tests the views aggregator result table style plugin.
Namespace
Drupal\Tests\views_aggregator\Functional\PluginCode
public function testAccessibilitySettings() {
$this
->drupalGet('va-test-style-table');
$result = $this
->xpath('//caption/child::text()');
$this
->assertTrue(count($result) > 0, 'The caption appears on the table.');
$this
->assertEquals('caption-text', trim($result[0]
->getText()));
$result = $this
->xpath('//summary/child::text()');
$this
->assertTrue(count($result) > 0, 'The summary appears on the table.');
$this
->assertEquals('summary-text', trim($result[0]
->getText()));
// Remove the caption and ensure the caption is not displayed anymore.
$view = View::load('va_test_style_table');
$display =& $view
->getDisplay('default');
$display['display_options']['style']['options']['caption'] = '';
$view
->save();
$this
->drupalGet('va-test-style-table');
$result = $this
->xpath('//caption/child::text()');
$this
->assertEquals('', trim($result[0]
->getText()), 'Ensure that the caption disappears.');
// Remove the table summary.
$display =& $view
->getDisplay('default');
$display['display_options']['style']['options']['summary'] = '';
$view
->save();
$this
->drupalGet('va-test-style-table');
$result = $this
->xpath('//summary/child::text()');
$this
->assertEquals(0, count($result), 'Ensure that the summary disappears.');
}