You are here

public function AjaxPageStateTest::testLibrariesAvailable in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/Render/AjaxPageStateTest.php \Drupal\Tests\system\Functional\Render\AjaxPageStateTest::testLibrariesAvailable()
  2. 9 core/modules/system/tests/src/Functional/Render/AjaxPageStateTest.php \Drupal\Tests\system\Functional\Render\AjaxPageStateTest::testLibrariesAvailable()

Default functionality without the param ajax_page_state[libraries].

The libraries active-link and drupalSettings are loaded default from core and available in code as scripts. Do this as the base test.

File

core/modules/system/tests/src/Functional/Render/AjaxPageStateTest.php, line 49

Class

AjaxPageStateTest
Performs tests for the effects of the ajax_page_state query parameter.

Namespace

Drupal\Tests\system\Functional\Render

Code

public function testLibrariesAvailable() {
  $this
    ->drupalGet('node', []);

  // The active link library from core should be loaded.
  $this
    ->assertSession()
    ->responseContains('/core/misc/active-link.js');

  // The drupalSettings library from core should be loaded.
  $this
    ->assertSession()
    ->responseContains('/core/misc/drupalSettingsLoader.js');
}