class BackwardCompatibilityTest
Same name and namespace in other branches
- 8.9.x core/tests/Drupal/FunctionalJavascriptTests/Ajax/BackwardCompatibilityTest.php \Drupal\FunctionalJavascriptTests\Ajax\BackwardCompatibilityTest
Tests the compatibility of the ajax.es6.js file.
@group Ajax
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\FunctionalJavascriptTests\WebDriverTestBase extends \Drupal\Tests\BrowserTestBase
- class \Drupal\FunctionalJavascriptTests\Ajax\BackwardCompatibilityTest extends \Drupal\FunctionalJavascriptTests\WebDriverTestBase
- class \Drupal\FunctionalJavascriptTests\WebDriverTestBase extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of BackwardCompatibilityTest
File
-
core/
tests/ Drupal/ FunctionalJavascriptTests/ Ajax/ BackwardCompatibilityTest.php, line 12
Namespace
Drupal\FunctionalJavascriptTests\AjaxView source
class BackwardCompatibilityTest extends WebDriverTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'js_ajax_test',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Ensures Drupal.Ajax.element_settings BC layer.
*/
public function testAjaxBackwardCompatibility() {
$this->drupalGet('/js_ajax_test');
$this->click('#edit-test-button');
$this->assertSession()
->waitForElement('css', '#js_ajax_test_form_element');
$elements = $this->cssSelect('#js_ajax_test_form_element');
$this->assertCount(1, $elements);
$json = $elements[0]->getText();
$data = json_decode($json, TRUE);
$this->assertEquals([
'element_settings' => 'catbro',
'elementSettings' => 'catbro',
], $data);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.