From 189d5a84d6d59366a9d4b368701905e401f25f62 Mon Sep 17 00:00:00 2001 From: Lauri Eskola Date: Mon, 2 May 2022 15:14:54 +0300 Subject: [PATCH] Issue #3269152 by yogeshmpawar, longwave, catch: Remove element_settings BC layer in ajax.js --- core/misc/ajax.es6.js | 10 --- core/misc/ajax.js | 1 - core/misc/cspell/dictionary.txt | 1 - .../js_ajax_test/js/js_ajax_test.ajax.es6.js | 29 --------- .../js_ajax_test/js/js_ajax_test.ajax.js | 18 ------ .../js_ajax_test/js_ajax_test.info.yml | 5 -- .../js_ajax_test/js_ajax_test.libraries.yml | 8 --- .../js_ajax_test/js_ajax_test.routing.yml | 6 -- .../src/Ajax/JsAjaxTestCommand.php | 22 ------- .../js_ajax_test/src/Form/JsAjaxTestForm.php | 64 ------------------- .../Ajax/BackwardCompatibilityTest.php | 45 ------------- 11 files changed, 209 deletions(-) delete mode 100644 core/modules/system/tests/modules/js_ajax_test/js/js_ajax_test.ajax.es6.js delete mode 100644 core/modules/system/tests/modules/js_ajax_test/js/js_ajax_test.ajax.js delete mode 100644 core/modules/system/tests/modules/js_ajax_test/js_ajax_test.info.yml delete mode 100644 core/modules/system/tests/modules/js_ajax_test/js_ajax_test.libraries.yml delete mode 100644 core/modules/system/tests/modules/js_ajax_test/js_ajax_test.routing.yml delete mode 100644 core/modules/system/tests/modules/js_ajax_test/src/Ajax/JsAjaxTestCommand.php delete mode 100644 core/modules/system/tests/modules/js_ajax_test/src/Form/JsAjaxTestForm.php delete mode 100644 core/tests/Drupal/FunctionalJavascriptTests/Ajax/BackwardCompatibilityTest.php diff --git a/core/misc/ajax.es6.js b/core/misc/ajax.es6.js index 94ff62df5da..08923ae52d0 100644 --- a/core/misc/ajax.es6.js +++ b/core/misc/ajax.es6.js @@ -417,16 +417,6 @@ */ this.element = element; - /** - * @deprecated in drupal:8.5.0 and is removed from drupal:10.0.0. - * Use elementSettings. - * - * @see https://www.drupal.org/node/2928117 - * - * @type {Drupal.Ajax~elementSettings} - */ - this.element_settings = elementSettings; - /** * @type {Drupal.Ajax~elementSettings} */ diff --git a/core/misc/ajax.js b/core/misc/ajax.js index bb8b964a5e8..b2f572c9d59 100644 --- a/core/misc/ajax.js +++ b/core/misc/ajax.js @@ -175,7 +175,6 @@ } this.element = element; - this.element_settings = elementSettings; this.elementSettings = elementSettings; if (this.element && this.element.form) { diff --git a/core/misc/cspell/dictionary.txt b/core/misc/cspell/dictionary.txt index c005d099e81..06aa2a39ad6 100644 --- a/core/misc/cspell/dictionary.txt +++ b/core/misc/cspell/dictionary.txt @@ -187,7 +187,6 @@ canonicalizing canvastext castable catalana -catbro catchable ccyy ccyymm diff --git a/core/modules/system/tests/modules/js_ajax_test/js/js_ajax_test.ajax.es6.js b/core/modules/system/tests/modules/js_ajax_test/js/js_ajax_test.ajax.es6.js deleted file mode 100644 index 89a5df8b301..00000000000 --- a/core/modules/system/tests/modules/js_ajax_test/js/js_ajax_test.ajax.es6.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * @file - * Testing behavior for JSWebAssertTest. - */ -(function ($, Drupal) { - /** - * Test Ajax command. - * - * @param {Drupal.Ajax} [ajax] - * {@link Drupal.Ajax} object created by {@link Drupal.Ajax}. - * @param {object} response - * The response from the Ajax request. - * @param {string} response.selector - * A jQuery selector string. - */ - Drupal.AjaxCommands.prototype.jsAjaxTestCommand = function (ajax, response) { - const $domElement = $(response.selector); - ajax.element_settings.cat = 'catbro'; - - const data = { - element_settings: ajax.element_settings.cat || {}, - elementSettings: ajax.elementSettings.cat || {}, - }; - - $domElement.html( - `
${JSON.stringify(data)}
`, - ); - }; -})(jQuery, Drupal); diff --git a/core/modules/system/tests/modules/js_ajax_test/js/js_ajax_test.ajax.js b/core/modules/system/tests/modules/js_ajax_test/js/js_ajax_test.ajax.js deleted file mode 100644 index eda1bbc2759..00000000000 --- a/core/modules/system/tests/modules/js_ajax_test/js/js_ajax_test.ajax.js +++ /dev/null @@ -1,18 +0,0 @@ -/** -* DO NOT EDIT THIS FILE. -* See the following change record for more information, -* https://www.drupal.org/node/2815083 -* @preserve -**/ - -(function ($, Drupal) { - Drupal.AjaxCommands.prototype.jsAjaxTestCommand = function (ajax, response) { - const $domElement = $(response.selector); - ajax.element_settings.cat = 'catbro'; - const data = { - element_settings: ajax.element_settings.cat || {}, - elementSettings: ajax.elementSettings.cat || {} - }; - $domElement.html(`
${JSON.stringify(data)}
`); - }; -})(jQuery, Drupal); \ No newline at end of file diff --git a/core/modules/system/tests/modules/js_ajax_test/js_ajax_test.info.yml b/core/modules/system/tests/modules/js_ajax_test/js_ajax_test.info.yml deleted file mode 100644 index fa4a6114eda..00000000000 --- a/core/modules/system/tests/modules/js_ajax_test/js_ajax_test.info.yml +++ /dev/null @@ -1,5 +0,0 @@ -name: 'JS Ajax test' -description: 'Provides custom ajax commands used for tests' -type: module -package: Testing -version: VERSION diff --git a/core/modules/system/tests/modules/js_ajax_test/js_ajax_test.libraries.yml b/core/modules/system/tests/modules/js_ajax_test/js_ajax_test.libraries.yml deleted file mode 100644 index 8f28e678440..00000000000 --- a/core/modules/system/tests/modules/js_ajax_test/js_ajax_test.libraries.yml +++ /dev/null @@ -1,8 +0,0 @@ -ajax: - version: VERSION - js: - js/js_ajax_test.ajax.js: {} - dependencies: - - core/jquery - - core/drupal - - core/drupal.ajax diff --git a/core/modules/system/tests/modules/js_ajax_test/js_ajax_test.routing.yml b/core/modules/system/tests/modules/js_ajax_test/js_ajax_test.routing.yml deleted file mode 100644 index 5d643b93d1b..00000000000 --- a/core/modules/system/tests/modules/js_ajax_test/js_ajax_test.routing.yml +++ /dev/null @@ -1,6 +0,0 @@ -js_ajax_test.js_ajax_test: - path: '/js_ajax_test' - defaults: - _form: '\Drupal\js_ajax_test\Form\JsAjaxTestForm' - requirements: - _access: 'TRUE' diff --git a/core/modules/system/tests/modules/js_ajax_test/src/Ajax/JsAjaxTestCommand.php b/core/modules/system/tests/modules/js_ajax_test/src/Ajax/JsAjaxTestCommand.php deleted file mode 100644 index 34641391893..00000000000 --- a/core/modules/system/tests/modules/js_ajax_test/src/Ajax/JsAjaxTestCommand.php +++ /dev/null @@ -1,22 +0,0 @@ - 'jsAjaxTestCommand', - 'selector' => '#js_ajax_test_form_wrapper', - ]; - } - -} diff --git a/core/modules/system/tests/modules/js_ajax_test/src/Form/JsAjaxTestForm.php b/core/modules/system/tests/modules/js_ajax_test/src/Form/JsAjaxTestForm.php deleted file mode 100644 index 89093cf6422..00000000000 --- a/core/modules/system/tests/modules/js_ajax_test/src/Form/JsAjaxTestForm.php +++ /dev/null @@ -1,64 +0,0 @@ -'; - $form['custom']['#suffix'] = ''; - - // Button to test for the waitForButton() assertion. - $form['test_button'] = [ - '#type' => 'submit', - '#value' => $this->t('Add button'), - '#button_type' => 'primary', - '#ajax' => [ - 'callback' => [static::class, 'addButton'], - 'progress' => [ - 'type' => 'throbber', - 'message' => NULL, - ], - 'wrapper' => 'js_ajax_test_form_wrapper', - ], - ]; - return $form; - } - - /** - * Ajax callback for the "Add button" button. - */ - public static function addButton(array $form, FormStateInterface $form_state) { - return (new AjaxResponse()) - ->addCommand(new JsAjaxTestCommand()); - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - // An empty implementation, as we never submit the actual form. - } - -} diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/BackwardCompatibilityTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/BackwardCompatibilityTest.php deleted file mode 100644 index b00bf1343f4..00000000000 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/BackwardCompatibilityTest.php +++ /dev/null @@ -1,45 +0,0 @@ -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); - } - -}