function PreprocessPagerTest::testPagerModalAttributes

Tests pager links get modal attributes when request is in a modal.

File

core/modules/system/tests/src/Unit/Pager/PreprocessPagerTest.php, line 199

Class

PreprocessPagerTest
Tests pager preprocessing.

Namespace

Drupal\Tests\system\Unit\Pager

Code

public function testPagerModalAttributes() : void {
  $variables = [
    'pager' => [
      '#element' => '',
      '#parameters' => [],
      '#quantity' => '',
      '#route_name' => '',
      '#tags' => '',
    ],
  ];
  $this->pagerPreprocess
    ->preprocessPager($variables);
  foreach ([
    'first',
    'previous',
  ] as $key) {
    $attributes = $variables['items'][$key]['attributes']->toArray();
    $this->assertEquals([
      'use-ajax',
    ], $attributes['class']);
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.