summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2015-08-10 11:47:28 +0100
committerAlex Pott2015-08-10 11:47:28 +0100
commit88470f95374dac54a5cefdf168e50b0c29e867b1 (patch)
tree326bfaaa991d05619d569d63b30c8001217b4f57
parentac3d63386a1f1bd50d05d7a5b5f5a1212c4862c4 (diff)
Issue #470428 by koence, cac2s, szt, foutrelis, cepinos, Wim Leers: Pager doesn't display right ellipsis if there is only one page left
-rw-r--r--core/includes/pager.inc2
-rw-r--r--core/modules/system/src/Tests/Pager/PagerTest.php23
2 files changed, 24 insertions, 1 deletions
diff --git a/core/includes/pager.inc b/core/includes/pager.inc
index 57f860c..86c32f1 100644
--- a/core/includes/pager.inc
+++ b/core/includes/pager.inc
@@ -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;
}
}
diff --git a/core/modules/system/src/Tests/Pager/PagerTest.php b/core/modules/system/src/Tests/Pager/PagerTest.php
index 133c90c..915eeec 100644
--- a/core/modules/system/src/Tests/Pager/PagerTest.php
+++ b/core/modules/system/src/Tests/Pager/PagerTest.php
@@ -96,6 +96,29 @@ class PagerTest extends WebTestBase {
}
/**
+ * 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.
*
* @param int $current_page