function AjaxPageStateTest::testLibrariesAvailable

Same name and namespace in other branches
  1. 9 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 html5shiv 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 50

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', []);
    $this->assertRaw('/core/assets/vendor/html5shiv/html5shiv.min.js', 'The html5shiv library from core should be loaded.');
    $this->assertRaw('/core/misc/drupalSettingsLoader.js', 'The drupalSettings library from core should be loaded.');
}

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