function ConfigTranslationUiTestBase::assertDisabledTextarea

Same name in other branches
  1. 10 core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTestBase.php \Drupal\Tests\config_translation\Functional\ConfigTranslationUiTestBase::assertDisabledTextarea()

Asserts that a textarea with a given ID has been disabled from editing.

@internal

Parameters

string $id: The HTML ID of the textarea.

1 call to ConfigTranslationUiTestBase::assertDisabledTextarea()
ConfigTranslationUiModulesTest::testTextFormatTranslation in core/modules/config_translation/tests/src/Functional/ConfigTranslationUiModulesTest.php
Tests text_format translation.

File

core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTestBase.php, line 183

Class

ConfigTranslationUiTestBase
Translate settings and entities to various languages.

Namespace

Drupal\Tests\config_translation\Functional

Code

protected function assertDisabledTextarea(string $id) : void {
    $textarea = $this->assertSession()
        ->fieldDisabled($id);
    $this->assertSame('textarea', $textarea->getTagName());
    $this->assertSame('This field has been disabled because you do not have sufficient permissions to edit it.', $textarea->getText());
    // Make sure the text format select is not shown.
    $select_id = str_replace('value', 'format--2', $id);
    $xpath = $this->assertSession()
        ->buildXPathQuery('//select[@id=:id]', [
        ':id' => $select_id,
    ]);
    $this->assertSession()
        ->elementNotExists('xpath', $xpath);
}

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