StyleHtmlListTest.php in Zircon Profile 8
File
core/modules/views/src/Tests/Plugin/StyleHtmlListTest.php
View source
<?php
namespace Drupal\views\Tests\Plugin;
use Drupal\views\Tests\ViewKernelTestBase;
use Drupal\views\Views;
class StyleHtmlListTest extends ViewKernelTestBase {
public static $testViews = array(
'test_style_html_list',
);
function testDefaultRowClasses() {
$view = Views::getView('test_style_html_list');
$output = $view
->preview();
$output = \Drupal::service('renderer')
->renderRoot($output);
$this
->assertTrue(strpos($output, '<div>') !== FALSE, 'Empty class is not added to DIV when class is not set');
$this
->assertTrue(strpos($output, '<ul>') !== FALSE, 'Empty class is not added to UL when class is not set');
$view->style_plugin->options['class'] = 'class';
$view->style_plugin->options['wrapper_class'] = 'wrapper-class';
$output = $view
->preview();
$output = \Drupal::service('renderer')
->renderRoot($output);
$this
->assertTrue(strpos($output, '<div class="wrapper-class">') !== FALSE, 'Class is added to DIV');
$this
->assertTrue(strpos($output, '<ul class="class">') !== FALSE, 'Class is added to UL');
}
}