Commit 91e164e6 authored by alexpott's avatar alexpott

Issue #1970136 by dawehner, olli: Fixed Read more link isn't rendered.

parent 80da26f3
......@@ -321,7 +321,7 @@ public function useGroupBy() {
*/
public function useMoreAlways() {
if ($this->usesMore()) {
return $this->getOption('useMoreAlways');
return $this->getOption('use_more_always');
}
return FALSE;
}
......@@ -331,7 +331,7 @@ public function useMoreAlways() {
*/
public function useMoreText() {
if ($this->usesMore()) {
return $this->getOption('useMoreText');
return $this->getOption('use_more_text');
}
return FALSE;
}
......@@ -1450,7 +1450,7 @@ public function buildOptionsForm(&$form, &$form_state) {
'#type' => 'textfield',
'#title' => t('More link text'),
'#description' => t("The text to display for the more link."),
'#default_value' => $this->getOption('useMoreText'),
'#default_value' => $this->getOption('use_more_text'),
'#states' => array(
'visible' => array(
':input[name="use_more"]' => array('checked' => TRUE),
......
......@@ -19,7 +19,7 @@ class DisplayTest extends PluginTestBase {
*
* @var array
*/
public static $testViews = array('test_filter_groups', 'test_get_attach_displays', 'test_view');
public static $testViews = array('test_filter_groups', 'test_get_attach_displays', 'test_view', 'test_display_more');
/**
* Modules to enable.
......@@ -143,4 +143,35 @@ public function testGetAttachedDisplays() {
$this->assertEqual($view->display_handler->getAttachedDisplays(), array());
}
/**
* Tests the readmore functionality.
*/
public function testReadMore() {
$expected_more_text = 'custom more text';
$view = views_get_view('test_display_more');
$this->executeView($view);
$output = $view->preview();
$output = drupal_render($output);
$this->drupalSetContent($output);
$result = $this->xpath('//div[@class=:class]/a', array(':class' => 'more-link'));
$this->assertEqual($result[0]->attributes()->href, url('test_display_more'), 'The right more link is shown.');
$this->assertEqual(trim($result[0][0]), $expected_more_text, 'The right link text is shown.');
// Test the renderMoreLink method directly. This could be directly unit
// tested.
$more_link = $view->display_handler->renderMoreLink();
$this->drupalSetContent($more_link);
$result = $this->xpath('//div[@class=:class]/a', array(':class' => 'more-link'));
$this->assertEqual($result[0]->attributes()->href, url('test_display_more'), 'The right more link is shown.');
$this->assertEqual(trim($result[0][0]), $expected_more_text, 'The right link text is shown.');
// Test the useMoreText method directly. This could be directly unit
// tested.
$more_text = $view->display_handler->useMoreText();
$this->assertEqual($more_text, $expected_more_text, 'The right more text is chosen.');
}
}
base_table: views_test_data
core: '8'
description: ''
status: '1'
display:
default:
display_options:
defaults:
fields: '0'
pager: '0'
pager_options: '0'
sorts: '0'
fields:
id:
field: id
id: id
relationship: none
table: views_test_data
plugin_id: numeric
pager:
options:
offset: '0'
type: none
pager_options: { }
sorts:
id:
field: id
id: id
order: ASC
relationship: none
table: views_test_data
plugin_id: numeric
use_more: '1'
use_more_always: '1'
use_more_text: 'custom more text'
link_display: page_1
display_plugin: default
display_title: Master
id: default
position: '0'
page_1:
display_plugin: page
id: page_1
display_title: Page
position: '1'
display_options:
path: test_display_more
label: 'Test display more'
id: test_display_more
tag: ''
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