Issue #2543132 by borisson_, JeroenT, dazz, PieterJanPut, gaele: Zero value not shown in views table style

8.0.x
Alex Pott 2015-08-22 17:41:13 +01:00
parent 08bd42bd72
commit b399f75c78
2 changed files with 28 additions and 1 deletions

View File

@ -109,4 +109,31 @@ class StyleTableTest extends PluginTestBase {
$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');
}
}

View File

@ -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'])) {