function DialogDeprecationsTest::testDialogDeprecations

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogDeprecationsTest.php \Drupal\FunctionalJavascriptTests\Dialog\DialogDeprecationsTest::testDialogDeprecations()

Tests that the deprecation events are triggered.

Attributes

#[IgnoreDeprecations]

File

core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogDeprecationsTest.php, line 35

Class

DialogDeprecationsTest
Tests jQuery events deprecations.

Namespace

Drupal\FunctionalJavascriptTests\Dialog

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.