Commit 07c6057f authored by alexpott's avatar alexpott
Browse files

Issue #2015165 by damiankloip: Exposed forms are not rendered in the Views UI preview.

parent 7b9e2297
......@@ -139,13 +139,12 @@ public function renderExposedForm($block = FALSE) {
$form_state['exposed_form_plugin'] = $this;
$form = drupal_build_form('views_exposed_form', $form_state);
$output = drupal_render($form);
if (!$this->view->display_handler->displaysExposed() || (!$block && $this->view->display_handler->getOption('exposed_block'))) {
return "";
return array();
}
else {
return $output;
return $form;
}
}
......
......@@ -99,7 +99,8 @@ public function testExposedFormRender() {
$view = views_get_view('test_reset_button');
$this->executeView($view);
$exposed_form = $view->display_handler->getPlugin('exposed_form');
$this->drupalSetContent($exposed_form->renderExposedForm());
$output = $exposed_form->renderExposedForm();
$this->drupalSetContent(drupal_render($output));
$expected_id = drupal_clean_css_identifier('views-exposed-form-' . $view->storage->id() . '-' . $view->current_display);
$this->assertFieldByXpath('//form/@id', $expected_id, 'Expected form ID found.');
......
......@@ -38,7 +38,33 @@ display:
label: Name
exclude: '0'
plugin_id: standard
filters: { }
filters:
id:
id: id
table: views_test_data
field: id
relationship: none
group_type: group
admin_label: ''
operator: '='
value:
min: ''
max: ''
value: ''
group: '1'
exposed: '1'
expose:
operator_id: id_op
label: 'ID'
description: ''
use_operator: '0'
operator: id_op
identifier: id
required: '0'
remember: '0'
multiple: '0'
is_grouped: '0'
plugin_id: numeric
sorts: { }
filter_groups:
operator: AND
......@@ -56,6 +82,42 @@ display:
title_enable: '0'
title: ''
plugin_id: numeric
header:
area_text_custom:
id: area_text_custom
table: views
field: area_text_custom
relationship: none
group_type: group
admin_label: ''
empty: '1'
content: 'Test header text'
tokenize: '0'
plugin_id: text_custom
footer:
area_text_custom:
id: area_text_custom
table: views
field: area_text_custom
relationship: none
group_type: group
admin_label: ''
empty: '1'
content: 'Test footer text'
tokenize: '0'
plugin_id: text_custom
empty:
area_text_custom:
id: area_text_custom
table: views
field: area_text_custom
relationship: none
group_type: group
admin_label: ''
empty: '1'
content: 'Test empty text'
tokenize: '0'
plugin_id: text_custom
label: test_preview
module: views
id: test_preview
......
......@@ -38,6 +38,14 @@ protected function testPreviewContextual() {
$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->drupalPost(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.');
}
/**
......@@ -63,6 +71,12 @@ function testPreviewUI() {
$elements = $this->xpath('//div[@class = "view-content"]/div[contains(@class, views-row)]');
$this->assertEqual(count($elements), 0);
// 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.');
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment