function CommandsTest::testLegacyAjaxCommands

Tests the various Ajax Commands with legacy parameters. @group legacy

File

core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php, line 151

Class

CommandsTest
Performs tests on AJAX framework commands.

Namespace

Drupal\FunctionalJavascriptTests\Ajax

Code

public function testLegacyAjaxCommands() : void {
    $session = $this->getSession();
    $page = $this->getSession()
        ->getPage();
    $form_path = 'ajax_forms_test_ajax_commands_form';
    $web_user = $this->drupalCreateUser([
        'access content',
    ]);
    $this->drupalLogin($web_user);
    $this->drupalGet($form_path);
    // Tests the 'add_css' command with legacy string value.
    $this->expectDeprecation('Javascript Deprecation: Passing a string to the Drupal.ajax.add_css() method is deprecated in 10.1.0 and is removed from drupal:11.0.0. See https://www.drupal.org/node/3154948.');
    $page->pressButton("AJAX 'add_css' legacy command");
    $this->assertWaitPageContains('my/file.css');
}

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