summaryrefslogtreecommitdiffstatshomepage
path: root/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogDeprecationsTest.php
blob: abc6fd4c5ca4c300328022894f823f1012770017 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?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');
  }

}