Skip to content
Snippets Groups Projects
Unverified Commit 108a6efd authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3123666 by smustgrave, larowlan, arunkumark, DuaelFr, acbramley, dpi,...

Issue #3123666 by smustgrave, larowlan, arunkumark, DuaelFr, acbramley, dpi, joshua1234511, Kristen Pol: Custom classes for pager links do not work with Claro theme
parent 0ac4b763
No related branches found
No related tags found
28 merge requests!54479.5.x SF update,!5014Issue #3071143: Table Render Array Example Is Incorrect,!4868Issue #1428520: Improve menu parent link selection,!4289Issue #1344552 by marcingy, Niklas Fiekas, Ravi.J, aleevas, Eduardo Morales...,!4114Issue #2707291: Disable body-level scrolling when a dialog is open as a modal,!4100Issue #3249600: Add support for PHP 8.1 Enums as allowed values for list_* data types,!3630Issue #2815301 by Chi, DanielVeza, kostyashupenko, smustgrave: Allow to create...,!3600Issue #3344629: Passing null to parameter #1 ($haystack) of type string is deprecated,!2378Issue #2875033: Optimize joins and table selection in SQL entity query implementation,!2334Issue #3228209: Add hasRole() method to AccountInterface,!2062Issue #3246454: Add weekly granularity to views date sort,!1591Issue #3199697: Add JSON:API Translation experimental module,!1484Exposed filters get values from URL when Ajax is on,!1255Issue #3238922: Refactor (if feasible) uses of the jQuery serialize function to use vanillaJS,!1162Issue #3100350: Unable to save '/' root path alias,!1105Issue #3025039: New non translatable field on translatable content throws error,!1073issue #3191727: Focus states on mobile second level navigation items fixed,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!925Issue #2339235: Remove taxonomy hard dependency on node module,!877Issue #2708101: Default value for link text is not saved,!872Draft: Issue #3221319: Race condition when creating menu links and editing content deletes menu links,!844Resolve #3036010 "Updaters",!617Issue #3043725: Provide a Entity Handler for user cancelation,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493,!485Sets the autocomplete attribute for username/password input field on login form.,!30Issue #3182188: Updates composer usage to point at ./vendor/bin/composer
...@@ -27,11 +27,13 @@ function pager_test_preprocess_pager(&$variables) { ...@@ -27,11 +27,13 @@ function pager_test_preprocess_pager(&$variables) {
foreach ($variables['items']['pages'] as $index => &$pager_item) { foreach ($variables['items']['pages'] as $index => &$pager_item) {
$pager_item['attributes']['pager-test'] = 'yes'; $pager_item['attributes']['pager-test'] = 'yes';
$pager_item['attributes']->addClass('lizards');
} }
unset($pager_item); unset($pager_item);
foreach (['first', 'previous', 'next', 'last'] as $special_pager_item) { foreach (['first', 'previous', 'next', 'last'] as $special_pager_item) {
if (isset($variables['items'][$special_pager_item])) { if (isset($variables['items'][$special_pager_item])) {
$variables['items'][$special_pager_item]['attributes']->addClass('lizards');
$variables['items'][$special_pager_item]['attributes']['pager-test'] = $special_pager_item; $variables['items'][$special_pager_item]['attributes']['pager-test'] = $special_pager_item;
} }
} }
......
...@@ -18,9 +18,11 @@ class ClaroTest extends BrowserTestBase { ...@@ -18,9 +18,11 @@ class ClaroTest extends BrowserTestBase {
* There's currently no way for Claro to provide a default and have valid * There's currently no way for Claro to provide a default and have valid
* configuration as themes cannot react to a module install. * configuration as themes cannot react to a module install.
* *
* Install dblog and pager_test for testing of pager attributes.
*
* @var string[] * @var string[]
*/ */
protected static $modules = ['shortcut']; protected static $modules = ['dblog', 'shortcut', 'pager_test'];
/** /**
* {@inheritdoc} * {@inheritdoc}
...@@ -68,4 +70,30 @@ public function testIsUninstallable() { ...@@ -68,4 +70,30 @@ public function testIsUninstallable() {
$this->assertSession()->pageTextContains('The Claro theme has been uninstalled.'); $this->assertSession()->pageTextContains('The Claro theme has been uninstalled.');
} }
/**
* Tests pager attribute is present using pager_test.
*/
public function testPagerAttribute(): void {
// Insert 300 log messages.
$logger = $this->container->get('logger.factory')->get('pager_test');
for ($i = 0; $i < 300; $i++) {
$logger->debug($this->randomString());
}
$this->drupalLogin($this->drupalCreateUser(['access site reports']));
$this->drupalGet('admin/reports/dblog', ['query' => ['page' => 1]]);
$this->assertSession()->statusCodeEquals(200);
$elements = $this->xpath('//ul[contains(@class, :class)]/li', [':class' => 'pager__items']);
$this->assertNotEmpty($elements, 'Pager found.');
// Check all links for pager-test attribute.
foreach ($elements as $page => $element) {
$link = $element->find('css', 'a');
$this->assertNotEmpty($link, "Link to page $page found.");
$this->assertTrue($link->hasAttribute('pager-test'), 'Pager item has attribute pager-test');
$this->assertTrue($link->hasClass('lizards'));
}
}
} }
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
{% if items.first %} {% if items.first %}
{% apply spaceless %} {% apply spaceless %}
<li class="pager__item pager__item--action pager__item--first"> <li class="pager__item pager__item--action pager__item--first">
<a href="{{ items.first.href }}" class="pager__link pager__link--action-link" title="{{ 'Go to first page'|t }}"{{ items.first.attributes|without('href', 'title') }}> <a href="{{ items.first.href }}" title="{{ 'Go to first page'|t }}"{{ items.first.attributes|without('href', 'title').addClass('pager__link', 'pager__link--action-link') }}>
<span class="visually-hidden">{{ 'First page'|t }}</span> <span class="visually-hidden">{{ 'First page'|t }}</span>
<span class="pager__item-title pager__item-title--backwards" aria-hidden="true"> <span class="pager__item-title pager__item-title--backwards" aria-hidden="true">
{{ items.first.text|default('First'|t)|replace({'«': ''}) }} {{ items.first.text|default('First'|t)|replace({'«': ''}) }}
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
{% if items.previous %} {% if items.previous %}
{% apply spaceless %} {% apply spaceless %}
<li class="pager__item pager__item--action pager__item--previous"> <li class="pager__item pager__item--action pager__item--previous">
<a href="{{ items.previous.href }}" class="pager__link pager__link--action-link" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes|without('href', 'title', 'rel') }}> <a href="{{ items.previous.href }}" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes|without('href', 'title', 'rel').addClass('pager__link', 'pager__link--action-link') }}>
<span class="visually-hidden">{{ 'Previous page'|t }}</span> <span class="visually-hidden">{{ 'Previous page'|t }}</span>
<span class="pager__item-title pager__item-title--backwards" aria-hidden="true"> <span class="pager__item-title pager__item-title--backwards" aria-hidden="true">
{{ items.previous.text|default('Previous'|t)|replace({'‹': ''}) }} {{ items.previous.text|default('Previous'|t)|replace({'‹': ''}) }}
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
{% else %} {% else %}
{% set title = 'Go to page @key'|t({'@key': key}) %} {% set title = 'Go to page @key'|t({'@key': key}) %}
{% endif %} {% endif %}
<a href="{{ item.href }}" class="pager__link{{ current == key ? ' is-active' }}" title="{{ title }}"{{ item.attributes|without('href', 'title', 'class') }}> <a href="{{ item.href }}" title="{{ title }}"{{ item.attributes|without('href', 'title').addClass(['pager__link', current == key ? ' is-active']) }}>
<span class="visually-hidden"> <span class="visually-hidden">
{{ current == key ? 'Current page'|t : 'Page'|t }} {{ current == key ? 'Current page'|t : 'Page'|t }}
</span> </span>
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
{% if items.next %} {% if items.next %}
{% apply spaceless %} {% apply spaceless %}
<li class="pager__item pager__item--action pager__item--next"> <li class="pager__item pager__item--action pager__item--next">
<a href="{{ items.next.href }}" class="pager__link pager__link--action-link" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes|without('href', 'title', 'rel') }}> <a href="{{ items.next.href }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes|without('href', 'title', 'rel').addClass('pager__link', 'pager__link--action-link') }}>
<span class="visually-hidden">{{ 'Next page'|t }}</span> <span class="visually-hidden">{{ 'Next page'|t }}</span>
<span class="pager__item-title pager__item-title--forward" aria-hidden="true"> <span class="pager__item-title pager__item-title--forward" aria-hidden="true">
{{ items.next.text|default('Next'|t)|replace({'›': ''}) }} {{ items.next.text|default('Next'|t)|replace({'›': ''}) }}
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
{% if items.last %} {% if items.last %}
{% apply spaceless %} {% apply spaceless %}
<li class="pager__item pager__item--action pager__item--last"> <li class="pager__item pager__item--action pager__item--last">
<a href="{{ items.last.href }}" class="pager__link pager__link--action-link" title="{{ 'Go to last page'|t }}"{{ items.last.attributes|without('href', 'title') }}> <a href="{{ items.last.href }}" title="{{ 'Go to last page'|t }}"{{ items.last.attributes|without('href', 'title').addClass('pager__link', 'pager__link--action-link') }}>
<span class="visually-hidden">{{ 'Last page'|t }}</span> <span class="visually-hidden">{{ 'Last page'|t }}</span>
<span class="pager__item-title pager__item-title--forward" aria-hidden="true"> <span class="pager__item-title pager__item-title--forward" aria-hidden="true">
{{ items.last.text|default('Last'|t)|replace({'»': ''}) }} {{ items.last.text|default('Last'|t)|replace({'»': ''}) }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment