function AjaxTest::testPropertyUrl
Same name and namespace in other branches
- 11.x core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php \Drupal\FunctionalJavascriptTests\Ajax\AjaxTest::testPropertyUrl()
Tests URLs that are also a JS object property are not mistakenly trusted.
File
-
core/
tests/ Drupal/ FunctionalJavascriptTests/ Ajax/ AjaxTest.php, line 377
Class
- AjaxTest
- Tests AJAX responses.
Namespace
Drupal\FunctionalJavascriptTests\AjaxCode
public function testPropertyUrl() : void {
$this->drupalGet('ajax-test/property-link');
$this->clickLink('Ajax constructor');
// The AJAX request should fail because the URL is not trusted.
$this->failOnJavascriptConsoleErrors = FALSE;
$this->assertSession()
->statusMessageContainsAfterWait("Oops, something went wrong. Check your browser's developer console for more details.", 'error');
// This is needed to avoid an unfinished AJAX request error from tearDown()
// because this test intentionally does not complete all AJAX requests.
$this->getSession()
->executeScript("delete window.drupalActiveXhrCount");
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.