Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
|
@ -129,6 +129,9 @@ class Internal extends CKEditorPluginBase implements ContainerFactoryPluginInter
|
|||
$button = function($name, $direction = 'ltr') {
|
||||
// In the markup below, we mostly use the name (which may include spaces),
|
||||
// but in one spot we use it as a CSS class, so strip spaces.
|
||||
// Note: this uses str_replace() instead of Html::cleanCssIdentifier()
|
||||
// because we must provide these class names exactly how CKEditor expects
|
||||
// them in its library, which cleanCssIdentifier() does not do.
|
||||
$class_name = str_replace(' ', '', $name);
|
||||
return [
|
||||
'#type' => 'inline_template',
|
||||
|
@ -146,48 +149,59 @@ class Internal extends CKEditorPluginBase implements ContainerFactoryPluginInter
|
|||
'Bold' => array(
|
||||
'label' => t('Bold'),
|
||||
'image_alternative' => $button('bold'),
|
||||
'image_alternative_rtl' => $button('bold', 'rtl'),
|
||||
),
|
||||
'Italic' => array(
|
||||
'label' => t('Italic'),
|
||||
'image_alternative' => $button('italic'),
|
||||
'image_alternative_rtl' => $button('italic', 'rtl'),
|
||||
),
|
||||
'Underline' => array(
|
||||
'label' => t('Underline'),
|
||||
'image_alternative' => $button('underline'),
|
||||
'image_alternative_rtl' => $button('underline', 'rtl'),
|
||||
),
|
||||
'Strike' => array(
|
||||
'label' => t('Strike-through'),
|
||||
'image_alternative' => $button('strike'),
|
||||
'image_alternative_rtl' => $button('strike', 'rtl'),
|
||||
),
|
||||
'Superscript' => array(
|
||||
'label' => t('Superscript'),
|
||||
'image_alternative' => $button('super script'),
|
||||
'image_alternative_rtl' => $button('super script', 'rtl'),
|
||||
),
|
||||
'Subscript' => array(
|
||||
'label' => t('Subscript'),
|
||||
'image_alternative' => $button('sub script'),
|
||||
'image_alternative_rtl' => $button('sub script', 'rtl'),
|
||||
),
|
||||
// "removeformat" plugin.
|
||||
'RemoveFormat' => array(
|
||||
'label' => t('Remove format'),
|
||||
'image_alternative' => $button('remove format'),
|
||||
'image_alternative_rtl' => $button('remove format', 'rtl'),
|
||||
),
|
||||
// "justify" plugin.
|
||||
'JustifyLeft' => array(
|
||||
'label' => t('Align left'),
|
||||
'image_alternative' => $button('justify left'),
|
||||
'image_alternative_rtl' => $button('justify left', 'rtl'),
|
||||
),
|
||||
'JustifyCenter' => array(
|
||||
'label' => t('Align center'),
|
||||
'image_alternative' => $button('justify center'),
|
||||
'image_alternative_rtl' => $button('justify center', 'rtl'),
|
||||
),
|
||||
'JustifyRight' => array(
|
||||
'label' => t('Align right'),
|
||||
'image_alternative' => $button('justify right'),
|
||||
'image_alternative_rtl' => $button('justify right', 'rtl'),
|
||||
),
|
||||
'JustifyBlock' => array(
|
||||
'label' => t('Justify'),
|
||||
'image_alternative' => $button('justify block'),
|
||||
'image_alternative_rtl' => $button('justify block', 'rtl'),
|
||||
),
|
||||
// "list" plugin.
|
||||
'BulletedList' => array(
|
||||
|
@ -226,11 +240,13 @@ class Internal extends CKEditorPluginBase implements ContainerFactoryPluginInter
|
|||
'Blockquote' => array(
|
||||
'label' => t('Blockquote'),
|
||||
'image_alternative' => $button('blockquote'),
|
||||
'image_alternative_rtl' => $button('blockquote', 'rtl'),
|
||||
),
|
||||
// "horizontalrule" plugin
|
||||
'HorizontalRule' => array(
|
||||
'label' => t('Horizontal rule'),
|
||||
'image_alternative' => $button('horizontal rule'),
|
||||
'image_alternative_rtl' => $button('horizontal rule', 'rtl'),
|
||||
),
|
||||
// "clipboard" plugin.
|
||||
'Cut' => array(
|
||||
|
@ -264,6 +280,7 @@ class Internal extends CKEditorPluginBase implements ContainerFactoryPluginInter
|
|||
'SpecialChar' => array(
|
||||
'label' => t('Character map'),
|
||||
'image_alternative' => $button('special char'),
|
||||
'image_alternative_rtl' => $button('special char', 'rtl'),
|
||||
),
|
||||
'Format' => array(
|
||||
'label' => t('HTML block format'),
|
||||
|
@ -279,6 +296,7 @@ class Internal extends CKEditorPluginBase implements ContainerFactoryPluginInter
|
|||
'Table' => array(
|
||||
'label' => t('Table'),
|
||||
'image_alternative' => $button('table'),
|
||||
'image_alternative_rtl' => $button('table', 'rtl'),
|
||||
),
|
||||
// "showblocks" plugin.
|
||||
'ShowBlocks' => array(
|
||||
|
@ -290,11 +308,13 @@ class Internal extends CKEditorPluginBase implements ContainerFactoryPluginInter
|
|||
'Source' => array(
|
||||
'label' => t('Source code'),
|
||||
'image_alternative' => $button('source'),
|
||||
'image_alternative_rtl' => $button('source', 'rtl'),
|
||||
),
|
||||
// "maximize" plugin.
|
||||
'Maximize' => array(
|
||||
'label' => t('Maximize'),
|
||||
'image_alternative' => $button('maximize'),
|
||||
'image_alternative_rtl' => $button('maximize', 'rtl'),
|
||||
),
|
||||
// No plugin, separator "button" for toolbar builder UI use only.
|
||||
'-' => array(
|
||||
|
@ -496,6 +516,13 @@ class Internal extends CKEditorPluginBase implements ContainerFactoryPluginInter
|
|||
}
|
||||
// Tell CKEditor the tag is allowed, along with some tags.
|
||||
elseif (is_array($attributes)) {
|
||||
// Set defaults (these will be overridden below if more specific
|
||||
// values are present).
|
||||
$allowed[$tag] = array(
|
||||
'attributes' => FALSE,
|
||||
'styles' => FALSE,
|
||||
'classes' => FALSE,
|
||||
);
|
||||
// Configure allowed attributes, allowed "style" attribute values and
|
||||
// allowed "class" attribute values.
|
||||
// CKEditor only allows specific values for the "class" and "style"
|
||||
|
@ -560,6 +587,9 @@ class Internal extends CKEditorPluginBase implements ContainerFactoryPluginInter
|
|||
}
|
||||
}
|
||||
|
||||
ksort($allowed);
|
||||
ksort($disallowed);
|
||||
|
||||
return array($allowed, $disallowed);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,23 +87,23 @@ class CKEditorAdminTest extends WebTestBase {
|
|||
// Button groups
|
||||
array(
|
||||
array(
|
||||
'name' => t('Formatting'),
|
||||
'name' => 'Formatting',
|
||||
'items' => array('Bold', 'Italic',),
|
||||
),
|
||||
array(
|
||||
'name' => t('Links'),
|
||||
'name' => 'Links',
|
||||
'items' => array('DrupalLink', 'DrupalUnlink',),
|
||||
),
|
||||
array(
|
||||
'name' => t('Lists'),
|
||||
'name' => 'Lists',
|
||||
'items' => array('BulletedList', 'NumberedList',),
|
||||
),
|
||||
array(
|
||||
'name' => t('Media'),
|
||||
'name' => 'Media',
|
||||
'items' => array('Blockquote', 'DrupalImage',),
|
||||
),
|
||||
array(
|
||||
'name' => t('Tools'),
|
||||
'name' => 'Tools',
|
||||
'items' => array('Source',),
|
||||
),
|
||||
),
|
||||
|
@ -111,7 +111,7 @@ class CKEditorAdminTest extends WebTestBase {
|
|||
),
|
||||
'plugins' => array(),
|
||||
);
|
||||
$this->assertIdentical($ckeditor->getDefaultSettings(), $expected_default_settings);
|
||||
$this->assertIdentical($this->castSafeStrings($ckeditor->getDefaultSettings()), $expected_default_settings);
|
||||
|
||||
// Keep the "CKEditor" editor selected and click the "Configure" button.
|
||||
$this->drupalPostAjaxForm(NULL, $edit, 'editor_configure');
|
||||
|
@ -279,7 +279,7 @@ class CKEditorAdminTest extends WebTestBase {
|
|||
$expected_settings['plugins']['stylescombo']['styles'] = '';
|
||||
$editor = entity_load('editor', 'amazing_format');
|
||||
$this->assertTrue($editor instanceof Editor, 'An Editor config entity exists now.');
|
||||
$this->assertIdentical($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.');
|
||||
$this->assertIdentical($this->castSafeStrings($expected_settings), $this->castSafeStrings($editor->getSettings()), 'The Editor config entity has the correct settings.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -107,12 +107,12 @@ class CKEditorLoadingTest extends WebTestBase {
|
|||
$expected = array('formats' => array('filtered_html' => array(
|
||||
'format' => 'filtered_html',
|
||||
'editor' => 'ckeditor',
|
||||
'editorSettings' => $ckeditor_plugin->getJSSettings($editor),
|
||||
'editorSettings' => $this->castSafeStrings($ckeditor_plugin->getJSSettings($editor)),
|
||||
'editorSupportsContentFiltering' => TRUE,
|
||||
'isXssSafe' => FALSE,
|
||||
)));
|
||||
$this->assertTrue($editor_settings_present, "Text Editor module's JavaScript settings are on the page.");
|
||||
$this->assertIdentical($expected, $settings['editor'], "Text Editor module's JavaScript settings on the page are correct.");
|
||||
$this->assertIdentical($expected, $this->castSafeStrings($settings['editor']), "Text Editor module's JavaScript settings on the page are correct.");
|
||||
$this->assertTrue($editor_js_present, 'Text Editor JavaScript is present.');
|
||||
$this->assertTrue(count($body) === 1, 'A body field exists.');
|
||||
$this->assertTrue(count($format_selector) === 1, 'A single text format selector exists on the page.');
|
||||
|
@ -138,12 +138,12 @@ class CKEditorLoadingTest extends WebTestBase {
|
|||
'filtered_html' => array(
|
||||
'format' => 'filtered_html',
|
||||
'editor' => 'ckeditor',
|
||||
'editorSettings' => $ckeditor_plugin->getJSSettings($editor),
|
||||
'editorSettings' => $this->castSafeStrings($ckeditor_plugin->getJSSettings($editor)),
|
||||
'editorSupportsContentFiltering' => TRUE,
|
||||
'isXssSafe' => FALSE,
|
||||
)));
|
||||
$this->assertTrue($editor_settings_present, "Text Editor module's JavaScript settings are on the page.");
|
||||
$this->assertIdentical($expected, $settings['editor'], "Text Editor module's JavaScript settings on the page are correct.");
|
||||
$this->assertIdentical($expected, $this->castSafeStrings($settings['editor']), "Text Editor module's JavaScript settings on the page are correct.");
|
||||
$this->assertTrue($editor_js_present, 'Text Editor JavaScript is present.');
|
||||
$this->assertTrue(in_array('ckeditor/drupal.ckeditor', explode(',', $settings['ajaxPageState']['libraries'])), 'CKEditor glue library is present.');
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ class CKEditorTest extends KernelTestBase {
|
|||
'filter_html' => array(
|
||||
'status' => 1,
|
||||
'settings' => array(
|
||||
'allowed_html' => '<h2> <h3> <h4> <h5> <h6> <p> <br> <strong> <a>',
|
||||
'allowed_html' => '<h2 id> <h3> <h4> <h5> <h6> <p> <br> <strong> <a href hreflang>',
|
||||
)
|
||||
),
|
||||
),
|
||||
|
@ -94,8 +94,10 @@ class CKEditorTest extends KernelTestBase {
|
|||
'drupallink' => file_create_url('core/modules/ckeditor/js/plugins/drupallink/plugin.js'),
|
||||
),
|
||||
);
|
||||
$expected_config = $this->castSafeStrings($expected_config);
|
||||
ksort($expected_config);
|
||||
$this->assertIdentical($expected_config, $this->ckeditor->getJSSettings($editor), 'Generated JS settings are correct for default configuration.');
|
||||
ksort($expected_config['allowedContent']);
|
||||
$this->assertIdentical($expected_config, $this->castSafeStrings($this->ckeditor->getJSSettings($editor)), 'Generated JS settings are correct for default configuration.');
|
||||
|
||||
// Customize the configuration: add button, have two contextually enabled
|
||||
// buttons, and configure a CKEditor plugin setting.
|
||||
|
@ -116,18 +118,19 @@ class CKEditorTest extends KernelTestBase {
|
|||
$expected_config['drupalExternalPlugins']['llama_contextual_and_button'] = file_create_url('core/modules/ckeditor/tests/modules/js/llama_contextual_and_button.js');
|
||||
$expected_config['contentsCss'][] = file_create_url('core/modules/ckeditor/tests/modules/ckeditor_test.css');
|
||||
ksort($expected_config);
|
||||
$this->assertIdentical($expected_config, $this->ckeditor->getJSSettings($editor), 'Generated JS settings are correct for customized configuration.');
|
||||
$this->assertIdentical($expected_config, $this->castSafeStrings($this->ckeditor->getJSSettings($editor)), 'Generated JS settings are correct for customized configuration.');
|
||||
|
||||
// Change the allowed HTML tags; the "allowedContent" and "format_tags"
|
||||
// settings for CKEditor should automatically be updated as well.
|
||||
$format = $editor->getFilterFormat();
|
||||
$format->filters('filter_html')->settings['allowed_html'] .= '<pre> <h3>';
|
||||
$format->filters('filter_html')->settings['allowed_html'] .= '<pre> <h1>';
|
||||
$format->save();
|
||||
|
||||
$expected_config['allowedContent']['pre'] = array('attributes' => TRUE, 'styles' => FALSE, 'classes' => TRUE);
|
||||
$expected_config['allowedContent']['h3'] = array('attributes' => TRUE, 'styles' => FALSE, 'classes' => TRUE);
|
||||
$expected_config['format_tags'] = 'p;h2;h3;h4;h5;h6;pre';
|
||||
$this->assertIdentical($expected_config, $this->ckeditor->getJSSettings($editor), 'Generated JS settings are correct for customized configuration.');
|
||||
$expected_config['allowedContent']['pre'] = array('attributes' => FALSE, 'styles' => FALSE, 'classes' => FALSE);
|
||||
$expected_config['allowedContent']['h1'] = array('attributes' => FALSE, 'styles' => FALSE, 'classes' => FALSE);
|
||||
$expected_config['format_tags'] = 'p;h1;h2;h3;h4;h5;h6;pre';
|
||||
ksort($expected_config['allowedContent']);
|
||||
$this->assertIdentical($expected_config, $this->castSafeStrings($this->ckeditor->getJSSettings($editor)), 'Generated JS settings are correct for customized configuration.');
|
||||
|
||||
// Disable the filter_html filter: allow *all *tags.
|
||||
$format->setFilterConfig('filter_html', array('status' => 0));
|
||||
|
@ -136,7 +139,7 @@ class CKEditorTest extends KernelTestBase {
|
|||
$expected_config['allowedContent'] = TRUE;
|
||||
$expected_config['disallowedContent'] = FALSE;
|
||||
$expected_config['format_tags'] = 'p;h1;h2;h3;h4;h5;h6;pre';
|
||||
$this->assertIdentical($expected_config, $this->ckeditor->getJSSettings($editor), 'Generated JS settings are correct for customized configuration.');
|
||||
$this->assertIdentical($expected_config, $this->castSafeStrings($this->ckeditor->getJSSettings($editor)), 'Generated JS settings are correct for customized configuration.');
|
||||
|
||||
// Enable the filter_test_restrict_tags_and_attributes filter.
|
||||
$format->setFilterConfig('filter_test_restrict_tags_and_attributes', array(
|
||||
|
@ -178,14 +181,17 @@ class CKEditorTest extends KernelTestBase {
|
|||
),
|
||||
'a' => array(
|
||||
'attributes' => 'href,rel,class,target',
|
||||
'styles' => FALSE,
|
||||
'classes' => 'external',
|
||||
),
|
||||
'span' => array(
|
||||
'attributes' => 'class,property,rel,style',
|
||||
'styles' => 'font-size',
|
||||
'classes' => FALSE,
|
||||
),
|
||||
'*' => array(
|
||||
'attributes' => 'class,data-*',
|
||||
'styles' => FALSE,
|
||||
'classes' => 'is-a-hipster-llama,and-more',
|
||||
),
|
||||
'del' => array(
|
||||
|
@ -205,7 +211,9 @@ class CKEditorTest extends KernelTestBase {
|
|||
);
|
||||
$expected_config['format_tags'] = 'p';
|
||||
ksort($expected_config);
|
||||
$this->assertIdentical($expected_config, $this->ckeditor->getJSSettings($editor), 'Generated JS settings are correct for customized configuration.');
|
||||
ksort($expected_config['allowedContent']);
|
||||
ksort($expected_config['disallowedContent']);
|
||||
$this->assertIdentical($expected_config, $this->castSafeStrings($this->ckeditor->getJSSettings($editor)), 'Generated JS settings are correct for customized configuration.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -216,7 +224,7 @@ class CKEditorTest extends KernelTestBase {
|
|||
|
||||
// Default toolbar.
|
||||
$expected = $this->getDefaultToolbarConfig();
|
||||
$this->assertIdentical($expected, $this->ckeditor->buildToolbarJSSetting($editor), '"toolbar" configuration part of JS settings built correctly for default toolbar.');
|
||||
$this->assertIdentical($expected, $this->castSafeStrings($this->ckeditor->buildToolbarJSSetting($editor)), '"toolbar" configuration part of JS settings built correctly for default toolbar.');
|
||||
|
||||
// Customize the configuration.
|
||||
$settings = $editor->getSettings();
|
||||
|
@ -224,7 +232,7 @@ class CKEditorTest extends KernelTestBase {
|
|||
$editor->setSettings($settings);
|
||||
$editor->save();
|
||||
$expected[0]['items'][] = 'Strike';
|
||||
$this->assertIdentical($expected, $this->ckeditor->buildToolbarJSSetting($editor), '"toolbar" configuration part of JS settings built correctly for customized toolbar.');
|
||||
$this->assertIdentical($expected, $this->castSafeStrings($this->ckeditor->buildToolbarJSSetting($editor)), '"toolbar" configuration part of JS settings built correctly for customized toolbar.');
|
||||
|
||||
// Enable the editor_test module, customize further.
|
||||
$this->enableModules(array('ckeditor_test'));
|
||||
|
@ -236,7 +244,7 @@ class CKEditorTest extends KernelTestBase {
|
|||
$editor->save();
|
||||
$expected[0]['name'] = 'JunkScience';
|
||||
$expected[0]['items'][] = 'Llama';
|
||||
$this->assertIdentical($expected, $this->ckeditor->buildToolbarJSSetting($editor), '"toolbar" configuration part of JS settings built correctly for customized toolbar with contrib module-provided CKEditor plugin.');
|
||||
$this->assertIdentical($expected, $this->castSafeStrings($this->ckeditor->buildToolbarJSSetting($editor)), '"toolbar" configuration part of JS settings built correctly for customized toolbar with contrib module-provided CKEditor plugin.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -420,17 +428,18 @@ class CKEditorTest extends KernelTestBase {
|
|||
}
|
||||
|
||||
protected function getDefaultAllowedContentConfig() {
|
||||
return array(
|
||||
'h2' => array('attributes' => TRUE, 'styles' => FALSE, 'classes' => TRUE),
|
||||
'h3' => array('attributes' => TRUE, 'styles' => FALSE, 'classes' => TRUE),
|
||||
'h4' => array('attributes' => TRUE, 'styles' => FALSE, 'classes' => TRUE),
|
||||
'h5' => array('attributes' => TRUE, 'styles' => FALSE, 'classes' => TRUE),
|
||||
'h6' => array('attributes' => TRUE, 'styles' => FALSE, 'classes' => TRUE),
|
||||
'p' => array('attributes' => TRUE, 'styles' => FALSE, 'classes' => TRUE),
|
||||
'br' => array('attributes' => TRUE, 'styles' => FALSE, 'classes' => TRUE),
|
||||
'strong' => array('attributes' => TRUE, 'styles' => FALSE, 'classes' => TRUE),
|
||||
'a' => array('attributes' => TRUE, 'styles' => FALSE, 'classes' => TRUE),
|
||||
);
|
||||
return [
|
||||
'h2' => ['attributes' => 'id', 'styles' => FALSE, 'classes' => FALSE],
|
||||
'h3' => ['attributes' => FALSE, 'styles' => FALSE, 'classes' => FALSE],
|
||||
'h4' => ['attributes' => FALSE, 'styles' => FALSE, 'classes' => FALSE],
|
||||
'h5' => ['attributes' => FALSE, 'styles' => FALSE, 'classes' => FALSE],
|
||||
'h6' => ['attributes' => FALSE, 'styles' => FALSE, 'classes' => FALSE],
|
||||
'p' => ['attributes' => FALSE, 'styles' => FALSE, 'classes' => FALSE],
|
||||
'br' => ['attributes' => FALSE, 'styles' => FALSE, 'classes' => FALSE],
|
||||
'strong' => ['attributes' => FALSE, 'styles' => FALSE, 'classes' => FALSE],
|
||||
'a' => ['attributes' => 'href,hreflang', 'styles' => FALSE, 'classes' => FALSE],
|
||||
'*' => ['attributes' => 'lang,dir', 'styles' => FALSE, 'classes' => FALSE],
|
||||
];
|
||||
}
|
||||
|
||||
protected function getDefaultDisallowedContentConfig() {
|
||||
|
@ -442,23 +451,23 @@ class CKEditorTest extends KernelTestBase {
|
|||
protected function getDefaultToolbarConfig() {
|
||||
return array(
|
||||
array(
|
||||
'name' => t('Formatting'),
|
||||
'name' => 'Formatting',
|
||||
'items' => array('Bold', 'Italic',),
|
||||
),
|
||||
array(
|
||||
'name' => t('Links'),
|
||||
'name' => 'Links',
|
||||
'items' => array('DrupalLink', 'DrupalUnlink',),
|
||||
),
|
||||
array(
|
||||
'name' => t('Lists'),
|
||||
'name' => 'Lists',
|
||||
'items' => array('BulletedList', 'NumberedList',),
|
||||
),
|
||||
array(
|
||||
'name' => t('Media'),
|
||||
'name' => 'Media',
|
||||
'items' => array('Blockquote', 'DrupalImage',),
|
||||
),
|
||||
array(
|
||||
'name' => t('Tools'),
|
||||
'name' => 'Tools',
|
||||
'items' => array('Source',),
|
||||
),
|
||||
'/',
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\ckeditor\Tests\CKEditorToolbarButtonTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\ckeditor\Tests;
|
||||
|
||||
|
||||
use Drupal\filter\Entity\FilterFormat;
|
||||
use Drupal\editor\Entity\Editor;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
use Drupal\Component\Serialization\Json;
|
||||
|
||||
/**
|
||||
* Tests CKEditor toolbar buttons when the language direction is RTL.
|
||||
*
|
||||
* @group ckeditor
|
||||
*/
|
||||
class CKEditorToolbarButtonTest extends WebTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable for this test.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = ['filter', 'editor', 'ckeditor', 'locale'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Create a text format and associate this with CKEditor.
|
||||
FilterFormat::create([
|
||||
'format' => 'full_html',
|
||||
'name' => 'Full HTML',
|
||||
'weight' => 1,
|
||||
'filters' => [],
|
||||
])->save();
|
||||
Editor::create([
|
||||
'format' => 'full_html',
|
||||
'editor' => 'ckeditor',
|
||||
])->save();
|
||||
|
||||
// Create a new user with admin rights.
|
||||
$this->admin_user = $this->drupalCreateUser([
|
||||
'administer languages',
|
||||
'access administration pages',
|
||||
'administer site configuration',
|
||||
'administer filters',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method tests CKEditor image buttons.
|
||||
*/
|
||||
public function testImageButtonDisplay() {
|
||||
global $base_url;
|
||||
$this->drupalLogin($this->admin_user);
|
||||
|
||||
// Install the Arabic language (which is RTL) and configure as the default.
|
||||
$edit = [];
|
||||
$edit['predefined_langcode'] = 'ar';
|
||||
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
|
||||
|
||||
$edit = ['site_default_language' => 'ar'];
|
||||
$this->drupalPostForm('admin/config/regional/language', $edit, t('Save configuration'));
|
||||
// Once the default language is changed, go to the tested text format
|
||||
// configuration page.
|
||||
$this->drupalGet('admin/config/content/formats/manage/full_html');
|
||||
|
||||
// Check if any image button is loaded in CKEditor json.
|
||||
$json_encode = function($html) {
|
||||
return trim(Json::encode($html), '"');
|
||||
};
|
||||
$markup = $json_encode($base_url . '/core/modules/ckeditor/js/plugins/drupalimage/image.png');
|
||||
$this->assertRaw($markup);
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue