function AjaxPageStateTest::testLibrariesAvailable

Same name in other branches
  1. 8.9.x core/modules/system/tests/src/Functional/Render/AjaxPageStateTest.php \Drupal\Tests\system\Functional\Render\AjaxPageStateTest::testLibrariesAvailable()
  2. 10 core/modules/system/tests/src/Functional/Render/AjaxPageStateTest.php \Drupal\Tests\system\Functional\Render\AjaxPageStateTest::testLibrariesAvailable()
  3. 11.x 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 52

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

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