You are here

public function WebformEntityTranslationTest::testSettingsTranslate in Webform 6.x

Tests settings translate.

File

tests/src/Functional/WebformEntityTranslationTest.php, line 38

Class

WebformEntityTranslationTest
Tests for webform translation.

Namespace

Drupal\Tests\webform\Functional

Code

public function testSettingsTranslate() {

  // Login admin user.
  $this
    ->drupalLogin($this->rootUser);
  $this
    ->drupalGet('/admin/structure/webform/config/translate/fr/add');

  // Check custom HTML source and translation.
  $mail_default_body_html = \Drupal::config('webform.settings')
    ->get('mail.default_body_html');
  $this
    ->assertRaw('<span lang="en">' . $mail_default_body_html . '</span>');
  $this
    ->assertCssSelect('textarea.js-html-editor[name="translation[config_names][webform.settings][settings][default_form_open_message][value]"]');

  // Check custom YAML source and translation.
  $this
    ->assertCssSelect('#edit-source-config-names-webformsettings-test-types textarea.js-webform-codemirror.yaml');
  $this
    ->assertCssSelect('textarea.js-webform-codemirror.yaml[name="translation[config_names][webform.settings][test][types]"]');

  // Check custom plain text source and translation.
  $this
    ->assertCssSelect('#edit-source-config-names-webformsettings-mail-default-body-text textarea.js-webform-codemirror.text');
  $this
    ->assertCssSelect('textarea.js-webform-codemirror.text[name="translation[config_names][webform.settings][mail][default_body_text]"]');
}