Skip to content
Snippets Groups Projects
Commit 1406b9ee authored by catch's avatar catch
Browse files

Issue #3521621 by mstrelan: [random test failure] jQuery Events Deprecation...

Issue #3521621 by mstrelan: [random test failure] jQuery Events Deprecation Tests (Tests/dialogDeprecations)

(cherry picked from commit 3cc2b895)
parent 0602c9ac
No related branches found
No related tags found
1 merge request!122353526426-warning-for-missing
Pipeline #487151 canceled
Pipeline: drupal

#487156

    <?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->assertNotNull($assert_session->waitForElement('css', '.ui-dialog-content'));
    $this->getSession()->executeScript("window.jQuery('.ui-dialog-content').trigger('dialogButtonsChange');");
    $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');
    }
    }
    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;
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment