Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / system / tests / modules / js_ajax_test / js / js_ajax_test.ajax.es6.js
1 /**
2  * @file
3  *  Testing behavior for JSWebAssertTest.
4  */
5 (function($, Drupal) {
6   /**
7    * Test Ajax command.
8    *
9    * @param {Drupal.Ajax} [ajax]
10    *   {@link Drupal.Ajax} object created by {@link Drupal.Ajax}.
11    * @param {object} response
12    *   The response from the Ajax request.
13    * @param {string} response.selector
14    *   A jQuery selector string.
15    */
16   Drupal.AjaxCommands.prototype.jsAjaxTestCommand = function(ajax, response) {
17     const $domElement = $(response.selector);
18     ajax.element_settings.cat = 'catbro';
19
20     const data = {
21       element_settings: ajax.element_settings.cat || {},
22       elementSettings: ajax.elementSettings.cat || {},
23     };
24
25     $domElement.html(
26       `<div id="js_ajax_test_form_element">${JSON.stringify(data)}</div>`,
27     );
28   };
29 })(jQuery, Drupal);