You are here

function CKEditorTest::testJSTranslation in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/ckeditor/src/Tests/CKEditorTest.php \Drupal\ckeditor\Tests\CKEditorTest::testJSTranslation()

Tests that CKEditor plugins participate in JS translation.

File

core/modules/ckeditor/src/Tests/CKEditorTest.php, line 384
Contains \Drupal\ckeditor\Tests\CKEditorTest.

Class

CKEditorTest
Tests for the 'CKEditor' text editor plugin.

Namespace

Drupal\ckeditor\Tests

Code

function testJSTranslation() {
  $this
    ->enableModules(array(
    'language',
    'locale',
  ));
  $this
    ->installSchema('locale', 'locales_source');
  $this
    ->installSchema('locale', 'locales_location');
  $this
    ->installSchema('locale', 'locales_target');
  $editor = Editor::load('filtered_html');
  $this->ckeditor
    ->getJSSettings($editor);
  $localeStorage = $this->container
    ->get('locale.storage');
  $string = $localeStorage
    ->findString(array(
    'source' => 'Edit Link',
    'context' => '',
  ));
  $this
    ->assertTrue(!empty($string), 'String from JavaScript file saved.');

  // With locale module, CKEditor should not adhere to the language selected.
  $this
    ->assertCKEditorLanguage();
}