BackwardCompatibilityTest.php 922 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace Drupal\FunctionalJavascriptTests\Ajax;
  3. use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
  4. /**
  5. * Tests the compatibility of the ajax.es6.js file.
  6. *
  7. * @group Ajax
  8. */
  9. class BackwardCompatibilityTest extends WebDriverTestBase {
  10. /**
  11. * {@inheritdoc}
  12. */
  13. public static $modules = [
  14. 'js_ajax_test',
  15. ];
  16. /**
  17. * Ensures Drupal.Ajax.element_settings BC layer.
  18. */
  19. public function testAjaxBackwardCompatibility() {
  20. $this->drupalGet('/js_ajax_test');
  21. $this->click('#edit-test-button');
  22. $this->assertSession()
  23. ->waitForElement('css', '#js_ajax_test_form_element');
  24. $elements = $this->cssSelect('#js_ajax_test_form_element');
  25. $this->assertCount(1, $elements);
  26. $json = $elements[0]->getText();
  27. $data = json_decode($json, TRUE);
  28. $this->assertEquals([
  29. 'element_settings' => 'catbro',
  30. 'elementSettings' => 'catbro',
  31. ], $data);
  32. }
  33. }