function PreviewTest::testPreviewSortLink
Same name in other branches
- 9 core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php \Drupal\Tests\views_ui\FunctionalJavascript\PreviewTest::testPreviewSortLink()
- 10 core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php \Drupal\Tests\views_ui\FunctionalJavascript\PreviewTest::testPreviewSortLink()
- 11.x core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php \Drupal\Tests\views_ui\FunctionalJavascript\PreviewTest::testPreviewSortLink()
Tests the link to sort in the preview form.
File
-
core/
modules/ views_ui/ tests/ src/ FunctionalJavascript/ PreviewTest.php, line 229
Class
- PreviewTest
- Tests the UI preview functionality.
Namespace
Drupal\Tests\views_ui\FunctionalJavascriptCode
public function testPreviewSortLink() {
// Get the preview.
$this->getPreviewAJAX('test_click_sort_ajax', 'page_1', 0);
// Test that the header label is present.
$elements = $this->xpath('//th[contains(@class, :class)]/a', [
':class' => 'views-field views-field-name',
]);
$this->assertTrue(!empty($elements), 'The header label is present.');
// Verify link.
$this->assertLinkByHref('preview/page_1?_wrapper_format=drupal_ajax&order=name&sort=desc', 0, 'The output URL is as expected.');
// Click link to sort.
$elements[0]->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->assertLinkByHref('preview/page_1?_wrapper_format=drupal_ajax&order=name&sort=asc', 0, 'The output URL is as expected.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.