Commit b399f75c authored by alexpott's avatar alexpott

Issue #2543132 by borisson_, JeroenT, dazz, PieterJanPut, gaele: Zero value...

Issue #2543132 by borisson_, JeroenT, dazz, PieterJanPut, gaele: Zero value not shown in views table style
parent 08bd42bd
......@@ -109,4 +109,31 @@ public function testFieldInColumns() {
$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.
if (!empty($field_output)) {
if (trim($field_output) != '') {
// Place the field into the column, along with an optional separator.
if (!empty($column_reference['content'])) {
if (!empty($options['info'][$column]['separator'])) {
......
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