function PaginationAJAXTest::assertNoDuplicateAssetsOnPage

Same name in other branches
  1. 9 core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php \Drupal\Tests\views\FunctionalJavascript\PaginationAJAXTest::assertNoDuplicateAssetsOnPage()
  2. 10 core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php \Drupal\Tests\views\FunctionalJavascript\PaginationAJAXTest::assertNoDuplicateAssetsOnPage()
  3. 11.x core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php \Drupal\Tests\views\FunctionalJavascript\PaginationAJAXTest::assertNoDuplicateAssetsOnPage()

Assert that assets are not loaded twice on a page.

1 call to PaginationAJAXTest::assertNoDuplicateAssetsOnPage()
PaginationAJAXTest::testBasicPagination in core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php
Tests if pagination via AJAX works for the "Content" View.

File

core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php, line 140

Class

PaginationAJAXTest
Tests the click sorting AJAX functionality of Views exposed forms.

Namespace

Drupal\Tests\views\FunctionalJavascript

Code

protected function assertNoDuplicateAssetsOnPage() {
    
    /** @var \Behat\Mink\Element\NodeElement[] $scripts */
    $scripts = $this->getSession()
        ->getPage()
        ->findAll('xpath', '//script');
    $script_src = [];
    foreach ($scripts as $script) {
        $this->assertNotContains($script->getAttribute('src'), $script_src);
        $script_src[] = $script->getAttribute('src');
    }
}

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