Skip to content
Snippets Groups Projects
Commit f9237efb 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)
parent 48c71f05
Branches
Tags
3 merge requests!5423Draft: Resolve #3329907 "Test2",!3478Issue #3337882: Deleted menus are not removed from content type config,!579Issue #2230909: Simple decimals fail to pass validation
Pipeline #484608 passed
Pipeline: drupal

#484609

    <?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');
    }
    }
    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