public function PreviewTest::testPreviewContextual in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views_ui/src/Tests/PreviewTest.php \Drupal\views_ui\Tests\PreviewTest::testPreviewContextual()
Tests contextual links in the preview form.
File
- core/
modules/ views_ui/ src/ Tests/ PreviewTest.php, line 29 - Contains \Drupal\views_ui\Tests\PreviewTest.
Class
- PreviewTest
- Tests the UI preview functionality.
Namespace
Drupal\views_ui\TestsCode
public function testPreviewContextual() {
\Drupal::service('module_installer')
->install(array(
'contextual',
));
$this
->resetAll();
$this
->drupalGet('admin/structure/views/view/test_preview/edit');
$this
->assertResponse(200);
$this
->drupalPostForm(NULL, $edit = array(), t('Update preview'));
$elements = $this
->xpath('//div[@id="views-live-preview"]//ul[contains(@class, :ul-class)]/li[contains(@class, :li-class)]', array(
':ul-class' => 'contextual-links',
':li-class' => 'filter-add',
));
$this
->assertEqual(count($elements), 1, 'The contextual link to add a new field is shown.');
$this
->drupalPostForm(NULL, $edit = array(
'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.');
}