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