You are here

protected function NoJavaScriptAnonymousTest::assertNoJavaScript in Drupal 10

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

Passes if no JavaScript is found on the page.

@internal

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 105

Class

NoJavaScriptAnonymousTest
Tests that anonymous users are not served any JavaScript.

Namespace

Drupal\Tests\system\Functional\Common

Code

protected function assertNoJavaScript() : void {

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