Commit 88470f95 authored by alexpott's avatar alexpott
Browse files

Issue #470428 by koence, cac2s, szt, foutrelis, cepinos, Wim Leers: Pager...

Issue #470428 by koence, cac2s, szt, foutrelis, cepinos, Wim Leers: Pager doesn't display right ellipsis if there is only one page left
parent ac3d6338
......@@ -250,7 +250,7 @@ function template_preprocess_pager(&$variables) {
}
}
// Add an ellipsis if there are further next pages.
if ($i < $pager_max) {
if ($i < $pager_max + 1) {
$variables['ellipses']['next'] = TRUE;
}
}
......
......@@ -95,6 +95,29 @@ protected function testPagerQueryParametersAndCacheContext() {
$this->assertCacheContext('url.query_args');
}
/**
* Test proper functioning of the ellipsis.
*/
public function testPagerEllipsis() {
// Insert 100 extra log messages to get 9 pages.
$logger = $this->container->get('logger.factory')->get('pager_test');
for ($i = 0; $i < 100; $i++) {
$logger->debug($this->randomString());
}
$this->drupalGet('admin/reports/dblog');
$elements = $this->cssSelect(".pager__item--ellipsis:contains('…')");
$this->assertEqual(count($elements), 0, 'No ellipsis has been set.');
// Insert an extra 50 log messages to get 10 pages.
$logger = $this->container->get('logger.factory')->get('pager_test');
for ($i = 0; $i < 50; $i++) {
$logger->debug($this->randomString());
}
$this->drupalGet('admin/reports/dblog');
$elements = $this->cssSelect(".pager__item--ellipsis:contains('…')");
$this->assertEqual(count($elements), 1, 'Found the ellipsis.');
}
/**
* Asserts pager items and links.
*
......
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