You are here

public function AjaxPageStateTest::testMultipleLibrariesAreNotLoaded in Drupal 8

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

Test 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 97

Class

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

Namespace

Drupal\Tests\system\Functional\Render

Code

public function testMultipleLibrariesAreNotLoaded() {
  $this
    ->drupalGet('node', [
    'query' => [
      'ajax_page_state' => [
        'libraries' => 'core/html5shiv,core/drupalSettings',
      ],
    ],
  ]);
  $this
    ->assertResponse(200);
  $this
    ->assertNoRaw('/core/assets/vendor/html5shiv/html5shiv.min.js', 'The html5shiv library from core should be excluded from loading.');
  $this
    ->assertNoRaw('/core/misc/drupalSettingsLoader.js', 'The drupalSettings library from core should be excluded from loading.');
  $this
    ->drupalGet('node');
  $this
    ->assertRaw('/core/assets/vendor/html5shiv/html5shiv.min.js', 'The html5shiv library from core should be included in loading.');
  $this
    ->assertRaw('/core/misc/drupalSettingsLoader.js', 'The drupalSettings library from core should be included in loading.');
}