function PreviewTest::testPreviewContextual
Same name in other branches
- 9 core/modules/views_ui/tests/src/Functional/PreviewTest.php \Drupal\Tests\views_ui\Functional\PreviewTest::testPreviewContextual()
- 10 core/modules/views_ui/tests/src/Functional/PreviewTest.php \Drupal\Tests\views_ui\Functional\PreviewTest::testPreviewContextual()
- 11.x core/modules/views_ui/tests/src/Functional/PreviewTest.php \Drupal\Tests\views_ui\Functional\PreviewTest::testPreviewContextual()
Tests contextual links in the preview form.
File
-
core/
modules/ views_ui/ tests/ src/ Functional/ PreviewTest.php, line 27
Class
- PreviewTest
- Tests the UI preview functionality.
Namespace
Drupal\Tests\views_ui\FunctionalCode
public function testPreviewContextual() {
\Drupal::service('module_installer')->install([
'contextual',
]);
$this->resetAll();
$this->drupalGet('admin/structure/views/view/test_preview/edit');
$this->assertSession()
->statusCodeEquals(200);
$this->drupalPostForm(NULL, $edit = [], t('Update preview'));
$elements = $this->xpath('//div[@id="views-live-preview"]//ul[contains(@class, :ul-class)]/li[contains(@class, :li-class)]', [
':ul-class' => 'contextual-links',
':li-class' => 'filter-add',
]);
$this->assertCount(1, $elements, 'The contextual link to add a new field is shown.');
$this->drupalPostForm(NULL, $edit = [
'view_args' => '100',
], t('Update preview'));
// Test that area text and exposed filters are present and rendered.
$this->assertFieldByName('id', NULL, 'ID exposed filter field found.');
$this->assertText('Test header text', 'Rendered header text found');
$this->assertText('Test footer text', 'Rendered footer text found.');
$this->assertText('Test empty text', 'Rendered empty text found.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.