public function AjaxPageStateTest::testMultipleLibrariesAreNotLoaded in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Functional/Render/AjaxPageStateTest.php \Drupal\Tests\system\Functional\Render\AjaxPageStateTest::testMultipleLibrariesAreNotLoaded()
- 9 core/modules/system/tests/src/Functional/Render/AjaxPageStateTest.php \Drupal\Tests\system\Functional\Render\AjaxPageStateTest::testMultipleLibrariesAreNotLoaded()
Tests if multiple libraries can be excluded.
The ajax_page_state[libraries] should be able to support multiple libraries comma separated.
File
- core/
modules/ system/ tests/ src/ Functional/ Render/ AjaxPageStateTest.php, line 88
Class
- AjaxPageStateTest
- Performs tests for the effects of the ajax_page_state query parameter.
Namespace
Drupal\Tests\system\Functional\RenderCode
public function testMultipleLibrariesAreNotLoaded() {
$this
->drupalGet('node', [
'query' => [
'ajax_page_state' => [
'libraries' => 'core/drupal,core/drupalSettings',
],
],
]);
$this
->assertSession()
->statusCodeEquals(200);
// The drupal library from core should be excluded from loading.
$this
->assertSession()
->responseNotContains('/core/misc/drupal.js');
// The drupalSettings library from core should be excluded from loading.
$this
->assertSession()
->responseNotContains('/core/misc/drupalSettingsLoader.js');
$this
->drupalGet('node');
// The drupal library from core should be included in loading.
$this
->assertSession()
->responseContains('/core/misc/drupal.js');
// The drupalSettings library from core should be included in loading.
$this
->assertSession()
->responseContains('/core/misc/drupalSettingsLoader.js');
}