Unverified Commit 59eb794a authored by alexpott's avatar alexpott

Issue #2935360 by Lendude, Kirst25: Views result summary still renders when there's no results

parent ecadaba6
......@@ -115,11 +115,13 @@ public function render($empty = FALSE) {
// Send the output.
if (!empty($total) || !empty($this->options['empty'])) {
$output .= Xss::filterAdmin(str_replace(array_keys($replacements), array_values($replacements), $format));
// Return as render array.
return [
'#markup' => $output,
];
}
// Return as render array.
return [
'#markup' => $output,
];
return [];
}
}
......@@ -57,6 +57,7 @@ public function testResultEmpty() {
$output = \Drupal::service('renderer')->renderRoot($output);
$this->setRawContent($output);
$this->assertText('start: 0 | end: 0 | total: 0 | label: test_area_result | per page: 0 | current page: 1 | current record count: 0 | page count: 1');
$this->assertRaw('<header>');
// Test that the area is not displayed if we have not checked the empty
// checkbox.
......@@ -67,6 +68,8 @@ public function testResultEmpty() {
$output = \Drupal::service('renderer')->renderRoot($output);
$this->setRawContent($output);
$this->assertNoText('start: 0 | end: 0 | total: 0 | label: test_area_result | per page: 0 | current page: 1 | current record count: 0 | page count: 1');
// Make sure the empty header region isn't rendered.
$this->assertNoRaw('<header>');
}
}
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