Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
19
web/core/modules/ckeditor/tests/modules/js/ajax-css.es6.js
Normal file
19
web/core/modules/ckeditor/tests/modules/js/ajax-css.es6.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* @file
|
||||
* Contains client-side code for testing CSS delivered to CKEditor via AJAX.
|
||||
*/
|
||||
|
||||
(function(Drupal, ckeditor, editorSettings, $) {
|
||||
Drupal.behaviors.ajaxCssForm = {
|
||||
attach(context) {
|
||||
// Initialize an inline CKEditor on the #edit-inline element if it
|
||||
// isn't editable already.
|
||||
$(context)
|
||||
.find('#edit-inline')
|
||||
.not('[contenteditable]')
|
||||
.each(function() {
|
||||
ckeditor.attachInlineEditor(this, editorSettings.formats.test_format);
|
||||
});
|
||||
},
|
||||
};
|
||||
})(Drupal, Drupal.editors.ckeditor, drupalSettings.editor, jQuery);
|
|
@ -1,24 +1,16 @@
|
|||
/**
|
||||
* @file
|
||||
* Contains client-side code for testing CSS delivered to CKEditor via AJAX.
|
||||
*/
|
||||
* DO NOT EDIT THIS FILE.
|
||||
* See the following change record for more information,
|
||||
* https://www.drupal.org/node/2815083
|
||||
* @preserve
|
||||
**/
|
||||
|
||||
(function (Drupal, ckeditor, editorSettings, $) {
|
||||
|
||||
'use strict';
|
||||
|
||||
Drupal.behaviors.ajaxCssForm = {
|
||||
|
||||
attach: function (context) {
|
||||
// Initialize an inline CKEditor on the #edit-inline element if it
|
||||
// isn't editable already.
|
||||
$(context)
|
||||
.find('#edit-inline')
|
||||
.not('[contenteditable]')
|
||||
.each(function () {
|
||||
ckeditor.attachInlineEditor(this, editorSettings.formats.test_format);
|
||||
});
|
||||
attach: function attach(context) {
|
||||
$(context).find('#edit-inline').not('[contenteditable]').each(function () {
|
||||
ckeditor.attachInlineEditor(this, editorSettings.formats.test_format);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
})(Drupal, Drupal.editors.ckeditor, drupalSettings.editor, jQuery);
|
||||
})(Drupal, Drupal.editors.ckeditor, drupalSettings.editor, jQuery);
|
|
@ -9,6 +9,8 @@ use Drupal\Core\Form\FormStateInterface;
|
|||
|
||||
/**
|
||||
* A form for testing delivery of CSS to CKEditor via AJAX.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class AjaxCssForm extends FormBase {
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use Drupal\Core\Form\FormStateInterface;
|
|||
use Drupal\editor\Entity\Editor;
|
||||
|
||||
/**
|
||||
* Defines a "LlamaContextualAndbutton" plugin, with a contextually OR toolbar
|
||||
* Defines a "LlamaContextualAndButton" plugin, with a contextually OR toolbar
|
||||
* builder-enabled "llama" feature.
|
||||
*
|
||||
* @CKEditorPlugin(
|
||||
|
|
|
@ -32,7 +32,7 @@ class LlamaCss extends Llama implements CKEditorPluginButtonsInterface, CKEditor
|
|||
*/
|
||||
public function getCssFiles(Editor $editor) {
|
||||
return [
|
||||
drupal_get_path('module', 'ckeditor_test') . '/css/llama.css'
|
||||
drupal_get_path('module', 'ckeditor_test') . '/css/llama.css',
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ class CKEditorAdminTest extends BrowserTestBase {
|
|||
// JavaScript's drupalSettings, and Unicode-escaped) is correctly rendered.
|
||||
$this->drupalGet('admin/config/content/formats/manage/filtered_html');
|
||||
// Create function to encode HTML as we expect it in drupalSettings.
|
||||
$json_encode = function($html) {
|
||||
$json_encode = function ($html) {
|
||||
return trim(Json::encode($html), '"');
|
||||
};
|
||||
// Check the Button separator.
|
||||
|
@ -216,6 +216,19 @@ class CKEditorAdminTest extends BrowserTestBase {
|
|||
$editor = Editor::load('filtered_html');
|
||||
$this->assertTrue($editor instanceof Editor, 'An Editor config entity exists.');
|
||||
$this->assertEqual($expected_settings, $editor->getSettings());
|
||||
|
||||
$this->drupalGet('admin/config/content/formats/add');
|
||||
// Now attempt to add another filter format with the same editor and same
|
||||
// machine name.
|
||||
$edit = [
|
||||
'format' => 'filtered_html',
|
||||
'name' => 'Filtered HTML',
|
||||
'editor[editor]' => 'ckeditor',
|
||||
];
|
||||
$this->submitForm($edit, 'editor_configure');
|
||||
$this->submitForm($edit, 'Save configuration');
|
||||
$this->assertResponse(200);
|
||||
$this->assertText('The machine-readable name is already in use. It must be unique.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -101,13 +101,17 @@ class CKEditorLoadingTest extends BrowserTestBase {
|
|||
list($settings, $editor_settings_present, $editor_js_present, $body, $format_selector) = $this->getThingsToCheck();
|
||||
$ckeditor_plugin = $this->container->get('plugin.manager.editor')->createInstance('ckeditor');
|
||||
$editor = Editor::load('filtered_html');
|
||||
$expected = ['formats' => ['filtered_html' => [
|
||||
'format' => 'filtered_html',
|
||||
'editor' => 'ckeditor',
|
||||
'editorSettings' => $this->castSafeStrings($ckeditor_plugin->getJSSettings($editor)),
|
||||
'editorSupportsContentFiltering' => TRUE,
|
||||
'isXssSafe' => FALSE,
|
||||
]]];
|
||||
$expected = [
|
||||
'formats' => [
|
||||
'filtered_html' => [
|
||||
'format' => 'filtered_html',
|
||||
'editor' => 'ckeditor',
|
||||
'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, $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.');
|
||||
|
@ -138,7 +142,9 @@ class CKEditorLoadingTest extends BrowserTestBase {
|
|||
'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, $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.');
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Drupal\Tests\ckeditor\Functional;
|
||||
|
||||
|
||||
use Drupal\filter\Entity\FilterFormat;
|
||||
use Drupal\editor\Entity\Editor;
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
|
@ -67,7 +66,7 @@ class CKEditorToolbarButtonTest extends BrowserTestBase {
|
|||
$this->drupalGet('admin/config/content/formats/manage/full_html');
|
||||
|
||||
// Check if any image button is loaded in CKEditor json.
|
||||
$json_encode = function($html) {
|
||||
$json_encode = function ($html) {
|
||||
return trim(Json::encode($html), '"');
|
||||
};
|
||||
$markup = $json_encode(file_url_transform_relative(file_create_url('core/modules/ckeditor/js/plugins/drupalimage/icons/drupalimage.png')));
|
||||
|
|
|
@ -4,14 +4,14 @@ namespace Drupal\Tests\ckeditor\FunctionalJavascript;
|
|||
|
||||
use Drupal\editor\Entity\Editor;
|
||||
use Drupal\filter\Entity\FilterFormat;
|
||||
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
|
||||
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
|
||||
|
||||
/**
|
||||
* Tests delivery of CSS to CKEditor via AJAX.
|
||||
*
|
||||
* @group ckeditor
|
||||
*/
|
||||
class AjaxCssTest extends JavascriptTestBase {
|
||||
class AjaxCssTest extends WebDriverTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -55,7 +55,7 @@ class AjaxCssTest extends JavascriptTestBase {
|
|||
// but not the iframe.
|
||||
$page->pressButton('Add CSS to inline CKEditor instance');
|
||||
|
||||
$result = $page->waitFor(10, function() use ($style_color) {
|
||||
$result = $page->waitFor(10, function () use ($style_color) {
|
||||
return ($this->getEditorStyle('edit-inline', 'color') == $style_color)
|
||||
&& ($this->getEditorStyle('edit-iframe-value', 'color') != $style_color);
|
||||
});
|
||||
|
@ -70,7 +70,7 @@ class AjaxCssTest extends JavascriptTestBase {
|
|||
// but not the main body.
|
||||
$page->pressButton('Add CSS to iframe CKEditor instance');
|
||||
|
||||
$result = $page->waitFor(10, function() use ($style_color) {
|
||||
$result = $page->waitFor(10, function () use ($style_color) {
|
||||
return ($this->getEditorStyle('edit-inline', 'color') != $style_color)
|
||||
&& ($this->getEditorStyle('edit-iframe-value', 'color') == $style_color);
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@ use Drupal\editor\Entity\Editor;
|
|||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\filter\Entity\FilterFormat;
|
||||
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
|
||||
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
|
||||
use Drupal\node\Entity\NodeType;
|
||||
|
||||
/**
|
||||
|
@ -15,7 +15,7 @@ use Drupal\node\Entity\NodeType;
|
|||
*
|
||||
* @group ckeditor
|
||||
*/
|
||||
class CKEditorIntegrationTest extends JavascriptTestBase {
|
||||
class CKEditorIntegrationTest extends WebDriverTestBase {
|
||||
|
||||
/**
|
||||
* The account.
|
||||
|
@ -24,6 +24,13 @@ class CKEditorIntegrationTest extends JavascriptTestBase {
|
|||
*/
|
||||
protected $account;
|
||||
|
||||
/**
|
||||
* The FilterFormat config entity used for testing.
|
||||
*
|
||||
* @var \Drupal\filter\FilterFormatInterface
|
||||
*/
|
||||
protected $filterFormat;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -36,12 +43,12 @@ class CKEditorIntegrationTest extends JavascriptTestBase {
|
|||
parent::setUp();
|
||||
|
||||
// Create a text format and associate CKEditor.
|
||||
$filtered_html_format = FilterFormat::create([
|
||||
$this->filterFormat = FilterFormat::create([
|
||||
'format' => 'filtered_html',
|
||||
'name' => 'Filtered HTML',
|
||||
'weight' => 0,
|
||||
]);
|
||||
$filtered_html_format->save();
|
||||
$this->filterFormat->save();
|
||||
|
||||
Editor::create([
|
||||
'format' => 'filtered_html',
|
||||
|
@ -92,9 +99,10 @@ class CKEditorIntegrationTest extends JavascriptTestBase {
|
|||
$session->getPage();
|
||||
|
||||
// Add a bottom margin to the title field to be sure the body field is not
|
||||
// visible. PhantomJS runs with a resolution of 1024x768px.
|
||||
$session->executeScript("document.getElementById('edit-title-0-value').style.marginBottom = '800px';");
|
||||
// visible.
|
||||
$session->executeScript("document.getElementById('edit-title-0-value').style.marginBottom = window.innerHeight*2 +'px';");
|
||||
|
||||
$this->assertSession()->waitForElementVisible('css', $ckeditor_id);
|
||||
// Check that the CKEditor-enabled body field is currently not visible in
|
||||
// the viewport.
|
||||
$web_assert->assertNotVisibleInViewport('css', $ckeditor_id, 'topLeft', 'CKEditor-enabled body field is visible.');
|
||||
|
@ -118,4 +126,55 @@ class CKEditorIntegrationTest extends JavascriptTestBase {
|
|||
self::assertEquals($before_url, $after_url, 'History back works.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if the Image button appears and works as expected.
|
||||
*/
|
||||
public function testDrupalImageDialog() {
|
||||
$session = $this->getSession();
|
||||
$web_assert = $this->assertSession();
|
||||
|
||||
$this->drupalGet('node/add/page');
|
||||
$session->getPage();
|
||||
|
||||
// Asserts the Image button is present in the toolbar.
|
||||
$web_assert->elementExists('css', '#cke_edit-body-0-value .cke_button__drupalimage');
|
||||
|
||||
// Asserts the image dialog opens when clicking the Image button.
|
||||
$this->click('.cke_button__drupalimage');
|
||||
$this->assertNotEmpty($web_assert->waitForElement('css', '.ui-dialog'));
|
||||
|
||||
$web_assert->elementContains('css', '.ui-dialog .ui-dialog-titlebar', 'Insert Image');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if the Drupal Image Caption plugin appears and works as expected.
|
||||
*/
|
||||
public function testDrupalImageCaptionDialog() {
|
||||
$web_assert = $this->assertSession();
|
||||
|
||||
// Disable the caption filter.
|
||||
$this->filterFormat->setFilterConfig('filter_caption', [
|
||||
'status' => FALSE,
|
||||
]);
|
||||
$this->filterFormat->save();
|
||||
|
||||
// If the caption filter is disabled, its checkbox should be absent.
|
||||
$this->drupalGet('node/add/page');
|
||||
$this->click('.cke_button__drupalimage');
|
||||
$this->assertNotEmpty($web_assert->waitForElement('css', '.ui-dialog'));
|
||||
$web_assert->elementNotExists('css', '.ui-dialog input[name="attributes[hasCaption]"]');
|
||||
|
||||
// Enable the caption filter again.
|
||||
$this->filterFormat->setFilterConfig('filter_caption', [
|
||||
'status' => TRUE,
|
||||
]);
|
||||
$this->filterFormat->save();
|
||||
|
||||
// If the caption filter is enabled, its checkbox should be present.
|
||||
$this->drupalGet('node/add/page');
|
||||
$this->click('.cke_button__drupalimage');
|
||||
$this->assertNotEmpty($web_assert->waitForElement('css', '.ui-dialog'));
|
||||
$web_assert->elementExists('css', '.ui-dialog input[name="attributes[hasCaption]"]');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ class CKEditorPluginManagerTest extends KernelTestBase {
|
|||
|
||||
// Case 2: CKEditor iframe instance CSS file.
|
||||
$expected = [
|
||||
'llama_css' => [drupal_get_path('module', 'ckeditor_test') . '/css/llama.css']
|
||||
'llama_css' => [drupal_get_path('module', 'ckeditor_test') . '/css/llama.css'],
|
||||
];
|
||||
$this->assertIdentical($expected, $this->manager->getCssFiles($editor), 'Iframe instance CSS file found.');
|
||||
}
|
|
@ -24,7 +24,7 @@ class CKEditorTest extends KernelTestBase {
|
|||
/**
|
||||
* An instance of the "CKEditor" text editor plugin.
|
||||
*
|
||||
* @var \Drupal\ckeditor\Plugin\Editor\CKEditor;
|
||||
* @var \Drupal\ckeditor\Plugin\Editor\CKEditor
|
||||
*/
|
||||
protected $ckeditor;
|
||||
|
||||
|
@ -50,7 +50,7 @@ class CKEditorTest extends KernelTestBase {
|
|||
'status' => 1,
|
||||
'settings' => [
|
||||
'allowed_html' => '<h2 id> <h3> <h4> <h5> <h6> <p> <br> <strong> <a href hreflang>',
|
||||
]
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
@ -479,7 +479,7 @@ class CKEditorTest extends KernelTestBase {
|
|||
],
|
||||
[
|
||||
'name' => 'Tools',
|
||||
'items' => ['Source', ],
|
||||
'items' => ['Source'],
|
||||
],
|
||||
'/',
|
||||
];
|
|
@ -20,7 +20,7 @@ class CKEditorPluginManagerTest extends UnitTestCase {
|
|||
return [
|
||||
'empty' => [
|
||||
[],
|
||||
[]
|
||||
[],
|
||||
],
|
||||
'1 row, 1 group' => [
|
||||
[
|
||||
|
@ -28,9 +28,9 @@ class CKEditorPluginManagerTest extends UnitTestCase {
|
|||
[
|
||||
// Group 1.
|
||||
['name' => 'Formatting', 'items' => ['Bold', 'Italic']],
|
||||
]
|
||||
],
|
||||
],
|
||||
['Bold', 'Italic']
|
||||
['Bold', 'Italic'],
|
||||
],
|
||||
'1 row, >1 groups' => [
|
||||
[
|
||||
|
@ -42,7 +42,7 @@ class CKEditorPluginManagerTest extends UnitTestCase {
|
|||
['name' => 'Linking', 'items' => ['Link']],
|
||||
],
|
||||
],
|
||||
['Bold', 'Italic', 'Link']
|
||||
['Bold', 'Italic', 'Link'],
|
||||
],
|
||||
'2 rows, 1 group each' => [
|
||||
[
|
||||
|
@ -76,7 +76,7 @@ class CKEditorPluginManagerTest extends UnitTestCase {
|
|||
['name' => 'Advanced', 'items' => ['Llama']],
|
||||
],
|
||||
],
|
||||
['Bold', 'Italic', 'Link', 'Source', 'Llama']
|
||||
['Bold', 'Italic', 'Link', 'Source', 'Llama'],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
|
Reference in a new issue