Issue #2543132 by borisson_, JeroenT, dazz, PieterJanPut, gaele: Zero value not shown in views table style
parent
08bd42bd72
commit
b399f75c78
|
@ -109,4 +109,31 @@ class StyleTableTest extends PluginTestBase {
|
||||||
$this->assertTrue(count($result), 'Ensure the job column values are joined into a single column');
|
$this->assertTrue(count($result), 'Ensure the job column values are joined into a single column');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that a number with the value of "0" is displayed in the table.
|
||||||
|
*/
|
||||||
|
public function testNumericFieldVisible() {
|
||||||
|
// Adds a new datapoint in the views_test_data table to have a person with
|
||||||
|
// an age of zero.
|
||||||
|
$data_set = $this->dataSet();
|
||||||
|
$query = db_insert('views_test_data')
|
||||||
|
->fields(array_keys($data_set[0]));
|
||||||
|
$query->values(array(
|
||||||
|
'name' => 'James McCartney',
|
||||||
|
'age' => 0,
|
||||||
|
'job' => 'Baby',
|
||||||
|
'created' => gmmktime(6, 30, 10, 1, 1, 2000),
|
||||||
|
'status' => 1,
|
||||||
|
));
|
||||||
|
$query->execute();
|
||||||
|
|
||||||
|
$this->drupalGet('test-table');
|
||||||
|
|
||||||
|
$result = $this->xpath('//tbody/tr/td[contains(., "Baby")]');
|
||||||
|
$this->assertTrue(count($result), 'Ensure that the baby is found.');
|
||||||
|
|
||||||
|
$result = $this->xpath('//tbody/tr/td[text()=0]');
|
||||||
|
$this->assertTrue(count($result), 'Ensure that the baby\'s age is shown');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -584,7 +584,7 @@ function template_preprocess_views_view_table(&$variables) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only bother with separators and stuff if the field shows up.
|
// Only bother with separators and stuff if the field shows up.
|
||||||
if (!empty($field_output)) {
|
if (trim($field_output) != '') {
|
||||||
// Place the field into the column, along with an optional separator.
|
// Place the field into the column, along with an optional separator.
|
||||||
if (!empty($column_reference['content'])) {
|
if (!empty($column_reference['content'])) {
|
||||||
if (!empty($options['info'][$column]['separator'])) {
|
if (!empty($options['info'][$column]['separator'])) {
|
||||||
|
|
Loading…
Reference in New Issue