function FrameworkTest::testCurrentPathChange

Same name in other branches
  1. 9 core/modules/system/tests/src/FunctionalJavascript/FrameworkTest.php \Drupal\Tests\system\FunctionalJavascript\FrameworkTest::testCurrentPathChange()
  2. 8.9.x core/modules/system/tests/src/FunctionalJavascript/FrameworkTest.php \Drupal\Tests\system\FunctionalJavascript\FrameworkTest::testCurrentPathChange()
  3. 11.x 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 89

Class

FrameworkTest
Tests the off-canvas dialog functionality.

Namespace

Drupal\Tests\system\FunctionalJavascript

Code

public function testCurrentPathChange() : void {
    $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']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.