diff --git a/core/modules/ckeditor/src/Tests/CKEditorTest.php b/core/modules/ckeditor/src/Tests/CKEditorTest.php index 9133ee0..91fc410 100644 --- a/core/modules/ckeditor/src/Tests/CKEditorTest.php +++ b/core/modules/ckeditor/src/Tests/CKEditorTest.php @@ -8,8 +8,7 @@ namespace Drupal\ckeditor\Tests; use Drupal\simpletest\KernelTestBase; -use Drupal\editor\Plugin\EditorManager; -use Drupal\ckeditor\Plugin\Editor\CKEditor; +use Drupal\language\Entity\ConfigurableLanguage; /** * Tests for the 'CKEditor' text editor plugin. @@ -368,6 +367,10 @@ function testLanguages() { // Language codes only in CKEditor. $this->assertTrue($langcodes['en-au'] == 'en-au', '"en-au" properly resolved'); $this->assertTrue($langcodes['sr-latn'] == 'sr-latn', '"sr-latn" properly resolved'); + + // No locale module, so even though languages are enabled, CK should still + // be in English. + $this->assertCKEditorLanguage('en'); } /** @@ -382,6 +385,20 @@ function testJSTranslation() { $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, CK should not adhere to the language selected. + $this->assertCKEditorLanguage(); + } + + /** + * Assert that CKEditor picks the expected language when French is default. + */ + protected function assertCKEditorLanguage($langcode = 'fr') { + ConfigurableLanguage::createFromLangcode('fr')->save(); + \Drupal::config('system.site')->set('langcode', 'fr'); + $editor = entity_load('editor', 'filtered_html'); + $settings = $this->ckeditor->getJSSettings($editor); + $this->assertEqual($settings['language'], $langcode); } protected function getDefaultInternalConfig() {