// Get the preview.
$this->
getPreviewAJAX('test_click_sort_ajax', 'page_1', 0
);
// Test that the header label is present.
$element =
$this->
assertSession()->
elementExists('xpath', '//th[contains(@class, "views-field views-field-name")]/a'
);
// Verify link.
$this->
assertSession()->
linkByHrefExists('preview/page_1?_wrapper_format=drupal_ajax&order=name&sort=desc', 0, 'The output URL is as expected.'
);
// Click link to sort.
$element->
click();
$sort_link =
$this->
assertSession()->
waitForElement('xpath', '//th[contains(@class, \'views-field views-field-name is-active\')]/a'
);
$this->
assertNotEmpty($sort_link);
// Verify link.
$this->
assertSession()->
linkByHrefExists('preview/page_1?_wrapper_format=drupal_ajax&order=name&sort=asc', 0, 'The output URL is as expected.'
);
} /**
* Get the preview form and force an AJAX preview update.
*
* @param string $view_name
* The view to test.
* @param string $panel_id
* The view panel to test.
* @param int $row_count
* The expected number of rows in the preview.
*/