You are here

protected function NoJavaScriptAnonymousTest::assertNoJavaScript in Drupal 9

Passes if no JavaScript is found on the page.

1 call to NoJavaScriptAnonymousTest::assertNoJavaScript()
NoJavaScriptAnonymousTest::testNoJavaScript in core/modules/system/tests/src/Functional/Common/NoJavaScriptAnonymousTest.php
Tests that anonymous users are not served any JavaScript.

File

core/modules/system/tests/src/Functional/Common/NoJavaScriptAnonymousTest.php, line 51

Class

NoJavaScriptAnonymousTest
Tests that anonymous users are not served any JavaScript in the Standard installation profile.

Namespace

Drupal\Tests\system\Functional\Common

Code

protected function assertNoJavaScript() {

  // Ensure drupalSettings is not set.
  $settings = $this
    ->getDrupalSettings();
  $this
    ->assertTrue(empty($settings), 'drupalSettings is not set.');
  $this
    ->assertSession()
    ->responseNotMatches('/\\.js/');
}