You are here

public function FrameworkTest::testCurrentPathChange in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/FunctionalJavascript/FrameworkTest.php \Drupal\Tests\system\FunctionalJavascript\FrameworkTest::testCurrentPathChange()

Tests that drupalSettings.currentPath is not updated on AJAX requests.

File

core/modules/system/tests/src/FunctionalJavascript/FrameworkTest.php, line 88

Class

FrameworkTest
Tests the off-canvas dialog functionality.

Namespace

Drupal\Tests\system\FunctionalJavascript

Code

public function testCurrentPathChange() {
  $this
    ->drupalGet('ajax_forms_test_lazy_load_form');
  $page = $this
    ->getSession()
    ->getPage();
  $assert = $this
    ->assertSession();
  $old_settings = $this
    ->getDrupalSettings();
  $page
    ->pressButton('Submit');
  $assert
    ->assertWaitOnAjaxRequest();
  $new_settings = $this
    ->getDrupalSettings();
  $this
    ->assertEquals($old_settings['path']['currentPath'], $new_settings['path']['currentPath']);
}