You are here

protected function PaginationAJAXTest::assertNoDuplicateAssetsOnPage in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php \Drupal\Tests\views\FunctionalJavascript\PaginationAJAXTest::assertNoDuplicateAssetsOnPage()
  2. 9 core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php \Drupal\Tests\views\FunctionalJavascript\PaginationAJAXTest::assertNoDuplicateAssetsOnPage()

Assert that assets are not loaded twice on a page.

@internal

File

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

Class

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

Namespace

Drupal\Tests\views\FunctionalJavascript

Code

protected function assertNoDuplicateAssetsOnPage() : void {

  /** @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');
  }
}