BackwardCompatibilityTest.php in Drupal 9
File
core/tests/Drupal/FunctionalJavascriptTests/Ajax/BackwardCompatibilityTest.php
View source
<?php
namespace Drupal\FunctionalJavascriptTests\Ajax;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
class BackwardCompatibilityTest extends WebDriverTestBase {
protected static $modules = [
'js_ajax_test',
];
protected $defaultTheme = 'stark';
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);
}
}