You are here

protected function PaginationAJAXTest::assertNoDuplicateAssetsOnPage in Drupal 9

Same name and namespace in other branches
  1. 8 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');
  }
}