function PagerModalTest::testPagerInsideModal

Tests pagers work inside of modals.

File

core/modules/system/tests/src/FunctionalJavascript/Pager/PagerModalTest.php, line 43

Class

PagerModalTest
Tests pager functionality in a modal.

Namespace

Drupal\Tests\system\FunctionalJavascript\Pager

Code

public function testPagerInsideModal() : void {
  $this->drupalGet(Url::fromRoute('pager_test.modal_pager'));
  $this->clickLink('Open modal');
  $this->assertSession()
    ->waitForElementVisible('css', '.pager-test-modal');
  $this->assertSession()
    ->responseContains('Pagers in modal');
  $this->assertSession()
    ->elementExists('css', '.test-pager-0')
    ->clickLink('Go to page 2');
  $this->assertSession()
    ->assertWaitOnAjaxRequest();
  $this->assertEquals('Page 2', $this->assertSession()
    ->elementExists('css', '.pager__item.is-active')
    ->getText());
  // Ensure we're still in the modal.
  $this->assertTrue($this->assertSession()
    ->elementExists('css', '#drupal-modal')
    ->isVisible());
}

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