Verified Commit aac1f617 authored by Dave Long's avatar Dave Long
Browse files

fix: #3572047 "Last" pager links inside a modal do not open in the modal

By: godotislate
By: sourav_paul
(cherry picked from commit 8b21d994)
parent d0b94dfc
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -160,7 +160,7 @@ public function preprocessPager(array &$variables): void {
      }

      $items['last'] = [];
      $items['last']['attributes'] = new Attribute();
      $items['last']['attributes'] = new Attribute($link_attributes);
      $options = [
        'query' => $this->pagerManager->getUpdatedParameters($parameters, $element, $pager_max - 1),
      ];
+4 −4
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ protected function setUp(): void {
      ->disableOriginalConstructor()
      ->getMock();

    $pager->method('getTotalPages')->willReturn(2);
    $pager->method('getTotalPages')->willReturn(3);
    $pager->method('getCurrentPage')->willReturn(1);

    $url_generator->method('generateFromRoute')->willReturn('');
@@ -83,7 +83,7 @@ public function testQuantityNotSet(): void {
    ];
    $this->pagerPreprocess->preprocessPager($variables);

    $this->assertEquals(['first', 'previous'], array_keys($variables['items']));
    $this->assertEquals(['first', 'previous', 'next', 'last'], array_keys($variables['items']));
  }

  /**
@@ -103,7 +103,7 @@ public function testQuantitySet(): void {
    ];
    $this->pagerPreprocess->preprocessPager($variables);

    $this->assertEquals(['first', 'previous', 'pages'], array_keys($variables['items']));
    $this->assertEquals(['first', 'previous', 'pages', 'next', 'last'], array_keys($variables['items']));
    /** @var \Drupal\Core\Template\AttributeString $attribute */
    $attribute = $variables['items']['pages']['2']['attributes']->offsetGet('aria-current');
    $this->assertInstanceOf(AttributeString::class, $attribute);
@@ -208,7 +208,7 @@ public function testPagerModalAttributes(): void {
    ];
    $this->pagerPreprocess->preprocessPager($variables);

    foreach (['first', 'previous'] as $key) {
    foreach (['first', 'previous', 'next', 'last'] as $key) {
      $attributes = $variables['items'][$key]['attributes']->toArray();
      $this->assertEquals(['use-ajax'], $attributes['class']);
    }