public function testResponsiveGrid(array
$options, array
$expected): void
{ // Create and preview a View with the provided options.
$view = Views::
getView('test_grid_responsive'
);
$view->
setDisplay('default'
);
$view->
initStyle();
$view->
initHandlers();
$view->
initQuery();
$view->style_plugin->options =
$options +
$view->style_plugin->options;
$this->
executeView($view);
$output =
$view->
preview();
$output = \Drupal::
service('renderer'
)->
renderRoot($output);
$this->
setRawContent($output);
// Confirm that the alignment class is added.
$result =
$this->
xpath('//div[contains(@class, "views-view-responsive-grid") and contains(@class, :alignment)]',
[':alignment' => 'views-view-responsive-grid--' .
$expected['alignment'
]]);
$this->
assertGreaterThan(0,
count($result), "Alignment CSS variable value is detected and correct."
);