summaryrefslogtreecommitdiffstatshomepage
path: root/core
diff options
context:
space:
mode:
authorcatch <6915-catch@users.noreply.drupalcode.org>2025-04-29 10:57:04 +0100
committercatch <6915-catch@users.noreply.drupalcode.org>2025-04-29 10:57:04 +0100
commitf9237efbff099ceda01823f7799232c09f2c5e4c (patch)
treee1550306e1d072ad5b8ab7403e4472cd2462ccf0 /core
parent48c71f0598fe8775f08aab8a6862daed7271d850 (diff)
downloaddrupal-f9237efbff099ceda01823f7799232c09f2c5e4c.tar.gz
drupal-f9237efbff099ceda01823f7799232c09f2c5e4c.zip
Issue #3521621 by mstrelan: [random test failure] jQuery Events Deprecation Tests (Tests/dialogDeprecations)
Diffstat (limited to 'core')
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogDeprecationsTest.php51
-rw-r--r--core/tests/Drupal/Nightwatch/Tests/dialogDeprecations.js36
2 files changed, 51 insertions, 36 deletions
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogDeprecationsTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogDeprecationsTest.php
new file mode 100644
index 00000000000..e91870a13d5
--- /dev/null
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogDeprecationsTest.php
@@ -0,0 +1,51 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Drupal\FunctionalJavascriptTests\Dialog;
+
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\IgnoreDeprecations;
+
+/**
+ * Tests jQuery events deprecations.
+ *
+ * @group dialog
+ */
+class DialogDeprecationsTest extends WebDriverTestBase {
+
+ /**
+ * {@inheritdoc}
+ */
+ protected $defaultTheme = 'stark';
+
+ /**
+ * {@inheritdoc}
+ */
+ protected static $modules = [
+ 'block',
+ 'js_deprecation_test',
+ ];
+
+ /**
+ * Tests that the deprecation events are triggered.
+ */
+ #[IgnoreDeprecations]
+ public function testDialogDeprecations(): void {
+ $this->drupalLogin($this->drupalCreateUser(['administer blocks']));
+ $this->drupalGet('/admin/structure/block');
+ $assert_session = $this->assertSession();
+
+ $button = $assert_session->waitForElement('css', '[data-drupal-selector="edit-blocks-region-sidebar-first-title"]');
+ $this->assertNotNull($button);
+ $button->click();
+
+ $this->getSession()->executeScript(<<<JS
+ setTimeout(() => {
+ window.jQuery('.ui-dialog-content').trigger('dialogButtonsChange');
+ }, 100);
+JS);
+ $this->expectDeprecation('Javascript Deprecation: jQuery event dialogButtonsChange is deprecated in 11.2.0 and is removed from Drupal:12.0.0. See https://www.drupal.org/node/3464202');
+ }
+
+}
diff --git a/core/tests/Drupal/Nightwatch/Tests/dialogDeprecations.js b/core/tests/Drupal/Nightwatch/Tests/dialogDeprecations.js
deleted file mode 100644
index 154a2932834..00000000000
--- a/core/tests/Drupal/Nightwatch/Tests/dialogDeprecations.js
+++ /dev/null
@@ -1,36 +0,0 @@
-const dialogDeprecationsTest = {
- '@tags': ['core', 'dialog'],
-
- before(browser) {
- browser
- .drupalInstall()
- .drupalInstallModule('block')
- .drupalInstallModule('js_deprecation_test')
- .drupalInstallModule('js_testing_log_test');
- },
- after(browser) {
- browser.drupalUninstall();
- },
-
- 'jQuery Events Deprecation Tests': (browser) => {
- browser.drupalLoginAsAdmin(() => {
- browser
- .drupalRelativeURL('/admin/structure/block')
- .waitForElementVisible('body', 1000)
- .execute(function () {
- const button = document.querySelector(
- '[data-drupal-selector="edit-blocks-region-sidebar-first-title"]',
- );
- button.click();
- setTimeout(() => {
- window.jQuery('.ui-dialog-content').trigger('dialogButtonsChange');
- }, 100);
- })
- .assert.deprecationErrorExists(
- 'jQuery event dialogButtonsChange is deprecated in 11.2.0 and is removed from Drupal:12.0.0. See https://www.drupal.org/node/3464202',
- );
- });
- },
-};
-
-module.exports = dialogDeprecationsTest;