diff --git a/core/modules/ckeditor5/ckeditor5.ckeditor5.yml b/core/modules/ckeditor5/ckeditor5.ckeditor5.yml index a2f8f55c226..e3256c37d73 100644 --- a/core/modules/ckeditor5/ckeditor5.ckeditor5.yml +++ b/core/modules/ckeditor5/ckeditor5.ckeditor5.yml @@ -352,11 +352,21 @@ ckeditor5_linkMedia: ckeditor5_list: ckeditor5: - plugins: [list.List] + plugins: + - list.List + - list.ListProperties + config: + list: + properties: + reversed: true + startIndex: true + # @todo Make this configurable in https://www.drupal.org/project/drupal/issues/3274635 + styles: false drupal: label: List library: core/ckeditor5.list admin_library: ckeditor5/admin.list + class: Drupal\ckeditor5\Plugin\CKEditor5Plugin\ListPlugin toolbar_items: bulletedList: label: Bulleted list @@ -364,7 +374,7 @@ ckeditor5_list: label: Numbered list elements: -
![]()
- '; + protected $defaultElementsAfterUpdatingToCkeditor5 = '
![]()
- '; /** * Test enabling CKEditor 5 in a way that triggers validation. diff --git a/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5Test.php b/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5Test.php index f181a4bd88e..fb35f270c50 100644 --- a/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5Test.php +++ b/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5Test.php @@ -13,7 +13,7 @@ use Drupal\Tests\TestFileCreationTrait; use Drupal\user\RoleInterface; use Symfony\Component\Validator\ConstraintViolation; -// cspell:ignore esque upcasted +// cspell:ignore esque splitbutton upcasted /** * Tests for CKEditor5. @@ -23,7 +23,6 @@ use Symfony\Component\Validator\ConstraintViolation; */ class CKEditor5Test extends CKEditor5TestBase { - use CKEditor5TestTrait; use TestFileCreationTrait; use CKEditor5TestTrait; @@ -446,6 +445,93 @@ class CKEditor5Test extends CKEditor5TestBase { $assert_session->responseContains('
This is a test!
'); } + /** + * Tests list plugin. + */ + public function testListPlugin() { + FilterFormat::create([ + 'format' => 'test_format', + 'name' => 'CKEditor 5 with list', + 'roles' => [RoleInterface::AUTHENTICATED_ID], + ])->save(); + Editor::create([ + 'format' => 'test_format', + 'editor' => 'ckeditor5', + 'settings' => [ + 'toolbar' => [ + 'items' => ['sourceEditing', 'numberedList'], + ], + 'plugins' => [ + 'ckeditor5_list' => [ + 'reversed' => FALSE, + 'startIndex' => FALSE, + ], + 'ckeditor5_sourceEditing' => [ + 'allowed_tags' => [], + ], + ], + ], + ])->save(); + $this->assertSame([], array_map( + function (ConstraintViolation $v) { + return (string) $v->getMessage(); + }, + iterator_to_array(CKEditor5::validatePair( + Editor::load('test_format'), + FilterFormat::load('test_format') + )) + )); + $ordered_list_html = ''; + $page = $this->getSession()->getPage(); + $assert_session = $this->assertSession(); + $this->drupalGet('node/add'); + $page->fillField('title[0][value]', 'My test content'); + $this->pressEditorButton('Source'); + $source_text_area = $assert_session->waitForElement('css', '.ck-source-editing-area textarea'); + $source_text_area->setValue($ordered_list_html); + // Click source again to make source inactive and have the numbered list + // splitbutton active. + $this->pressEditorButton('Source'); + $numbered_list_dropdown_selector = '.ck-splitbutton__arrow'; + + // Check that there is no dropdown available for the numbered list because + // both reversed and startIndex are FALSE. + $assert_session->elementNotExists('css', $numbered_list_dropdown_selector); + // Save content so source content is kept after changing the editor config. + $page->pressButton('Save'); + $edit_url = $this->getSession()->getCurrentURL() . '/edit'; + $this->drupalGet($edit_url); + $this->waitForEditor(); + + // Enable the reversed functionality. + $editor = Editor::load('test_format'); + $settings = $editor->getSettings(); + $settings['plugins']['ckeditor5_list']['reversed'] = TRUE; + $editor->setSettings($settings); + $editor->save(); + $this->getSession()->reload(); + $this->waitForEditor(); + $this->click($numbered_list_dropdown_selector); + $reversed_order_button_selector = '.ck.ck-button.ck-numbered-list-properties__reversed-order'; + $assert_session->elementExists('css', $reversed_order_button_selector); + $assert_session->elementTextEquals('css', $reversed_order_button_selector, 'Reversed order'); + $start_index_element_selector = '.ck.ck-numbered-list-properties__start-index'; + $assert_session->elementNotExists('css', $start_index_element_selector); + + // Have both the reversed and the start index enabled. + $editor = Editor::load('test_format'); + $settings = $editor->getSettings(); + $settings['plugins']['ckeditor5_list']['startIndex'] = TRUE; + $editor->setSettings($settings); + $editor->save(); + $this->getSession()->reload(); + $this->waitForEditor(); + $this->click($numbered_list_dropdown_selector); + $assert_session->elementExists('css', $reversed_order_button_selector); + $assert_session->elementTextEquals('css', $reversed_order_button_selector, 'Reversed order'); + $assert_session->elementExists('css', $start_index_element_selector); + } + /** * Ensures that CKEditor 5 retains filter_html's allowed global attributes. * diff --git a/core/modules/ckeditor5/tests/src/Kernel/CKEditor5PluginManagerTest.php b/core/modules/ckeditor5/tests/src/Kernel/CKEditor5PluginManagerTest.php index 14ae41cb6ef..747633aee78 100644 --- a/core/modules/ckeditor5/tests/src/Kernel/CKEditor5PluginManagerTest.php +++ b/core/modules/ckeditor5/tests/src/Kernel/CKEditor5PluginManagerTest.php @@ -982,7 +982,8 @@ PHP, // Configure the sneaky superset plugin to have a random tag as the subset. $sneaky_plugin_id = 'ckeditor5_plugin_elements_subset_sneakySuperset'; - $random_tag = "<{$this->randomMachineName()}>"; + $random_tag_name = strtolower($this->randomMachineName()); + $random_tag = "<$random_tag_name>"; $text_editor = Editor::create([ 'format' => 'dummy', 'editor' => 'ckeditor5', diff --git a/core/modules/ckeditor5/tests/src/Kernel/ConfigurablePluginTest.php b/core/modules/ckeditor5/tests/src/Kernel/ConfigurablePluginTest.php index d444f726b50..f35ad49dd1e 100644 --- a/core/modules/ckeditor5/tests/src/Kernel/ConfigurablePluginTest.php +++ b/core/modules/ckeditor5/tests/src/Kernel/ConfigurablePluginTest.php @@ -67,6 +67,10 @@ class ConfigurablePluginTest extends KernelTestBase { 'ckeditor5_sourceEditing' => [ 'allowed_tags' => [], ], + 'ckeditor5_list' => [ + 'reversed' => TRUE, + 'startIndex' => TRUE, + ], 'ckeditor5_imageResize' => [ 'allow_resize' => TRUE, ], diff --git a/core/modules/ckeditor5/tests/src/Kernel/SmartDefaultSettingsTest.php b/core/modules/ckeditor5/tests/src/Kernel/SmartDefaultSettingsTest.php index b2bc1c69260..921a43285bf 100644 --- a/core/modules/ckeditor5/tests/src/Kernel/SmartDefaultSettingsTest.php +++ b/core/modules/ckeditor5/tests/src/Kernel/SmartDefaultSettingsTest.php @@ -460,7 +460,7 @@ class SmartDefaultSettingsTest extends KernelTestBase { '', '
- apple
- banana
- cantaloupe
', '', - '
', + '
', '
', '
', '
', @@ -483,6 +483,10 @@ class SmartDefaultSettingsTest extends KernelTestBase { 'ckeditor5_language' => [ 'language_list' => 'un', ], + 'ckeditor5_list' => [ + 'reversed' => FALSE, + 'startIndex' => TRUE, + ], ], ], 'expected_superset' => '', @@ -500,7 +504,7 @@ class SmartDefaultSettingsTest extends KernelTestBase { [ 'expected_messages' => [ 'status' => [ - 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol start type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>.', + 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>.', ], ], ] @@ -523,7 +527,7 @@ class SmartDefaultSettingsTest extends KernelTestBase { ], 'expected_messages' => [ 'status' => [ - 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol start type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img data-caption>.', + 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img data-caption>.', ], ], ]); @@ -545,7 +549,7 @@ class SmartDefaultSettingsTest extends KernelTestBase { ], 'expected_messages' => [ 'status' => [ - 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol start type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img data-align>.', + 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img data-align>.', ], ], ]); @@ -571,13 +575,14 @@ class SmartDefaultSettingsTest extends KernelTestBase { ], 'ckeditor5_imageResize' => ['allow_resize' => TRUE], 'ckeditor5_language' => $basic_html_test_case['expected_ckeditor5_settings']['plugins']['ckeditor5_language'], + 'ckeditor5_list' => ['reversed' => FALSE, 'startIndex' => TRUE], ], ], 'expected_superset' => $basic_html_test_case['expected_superset'], 'expected_fundamental_compatibility_violations' => $basic_html_test_case['expected_fundamental_compatibility_violations'], 'expected_messages' => array_merge_recursive($basic_html_test_case['expected_messages'], [ 'status' => [ - 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol start type> <h2 id> <h3 id> <h5 id>.', + 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h5 id>.', ], ]), ]; @@ -603,13 +608,14 @@ class SmartDefaultSettingsTest extends KernelTestBase { ], 'ckeditor5_imageResize' => ['allow_resize' => TRUE], 'ckeditor5_language' => $basic_html_test_case['expected_ckeditor5_settings']['plugins']['ckeditor5_language'], + 'ckeditor5_list' => ['reversed' => FALSE, 'startIndex' => TRUE], ], ], 'expected_superset' => $basic_html_test_case['expected_superset'], 'expected_fundamental_compatibility_violations' => $basic_html_test_case['expected_fundamental_compatibility_violations'], 'expected_messages' => array_merge_recursive($basic_html_test_case['expected_messages'], [ 'status' => [ - 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol start type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>.', + 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>.', ], ]), ]; @@ -633,13 +639,14 @@ class SmartDefaultSettingsTest extends KernelTestBase { ], 'ckeditor5_imageResize' => ['allow_resize' => TRUE], 'ckeditor5_language' => $basic_html_test_case['expected_ckeditor5_settings']['plugins']['ckeditor5_language'], + 'ckeditor5_list' => ['reversed' => FALSE, 'startIndex' => TRUE], ], ], 'expected_superset' => $basic_html_test_case['expected_superset'], 'expected_fundamental_compatibility_violations' => $basic_html_test_case['expected_fundamental_compatibility_violations'], 'expected_messages' => array_merge_recursive($basic_html_test_case['expected_messages'], [ 'status' => [ - 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol start type>.', + 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol type>.', ], ]), ]; @@ -662,7 +669,7 @@ class SmartDefaultSettingsTest extends KernelTestBase { 'status' => [ 'The following plugins were enabled to support tags that are allowed by this text format: Code (for tags: <code>) Language (for tags: <span>) Code Block (for tags: <pre>).', $basic_html_test_case['expected_messages']['status'][1], - 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol start type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>.', + 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>.', ], ], ]; @@ -702,7 +709,7 @@ class SmartDefaultSettingsTest extends KernelTestBase { 'expected_messages' => array_merge_recursive($basic_html_test_case['expected_messages'], [ 'status' => [ 'The following plugins were enabled to support specific attributes that are allowed by this text format: Align center ( for tag: <p> to support: class with value(s): text-align-center), Justify ( for tag: <p> to support: class with value(s): text-align-justify).', - 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol start type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>.', + 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>.', ], ]), ]; @@ -725,7 +732,7 @@ class SmartDefaultSettingsTest extends KernelTestBase { 'expected_fundamental_compatibility_violations' => $basic_html_test_case['expected_fundamental_compatibility_violations'], 'expected_messages' => array_merge_recursive($basic_html_test_case['expected_messages'], [ 'status' => [ - "This format's HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin's Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol start type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>.", + "This format's HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin's Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>.", ], ]), ]; @@ -748,7 +755,7 @@ class SmartDefaultSettingsTest extends KernelTestBase { 'expected_fundamental_compatibility_violations' => $basic_html_test_case['expected_fundamental_compatibility_violations'], 'expected_messages' => array_merge_recursive($basic_html_test_case['expected_messages'], [ 'status' => [ - 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol start type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img data-*>.', + 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img data-*>.', ], ]), ]; @@ -798,7 +805,7 @@ class SmartDefaultSettingsTest extends KernelTestBase { '', '
', '', - '
', + '
', '
', '
', '
', @@ -806,6 +813,10 @@ class SmartDefaultSettingsTest extends KernelTestBase { '
', ], ], + 'ckeditor5_list' => [ + 'reversed' => FALSE, + 'startIndex' => TRUE, + ], ], ], 'expected_superset' => '
', @@ -816,7 +827,7 @@ class SmartDefaultSettingsTest extends KernelTestBase { 'status' => [ 'The following plugins were enabled to support tags that are allowed by this text format: Link (for tags: <a>) Block quote (for tags: <blockquote>) Code (for tags: <code>) List (for tags: <ul><ol><li>).', 'The following tags were permitted by this format\'s filter configuration, but no plugin was available that supports them. To ensure the tags remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <cite> <dl> <dt> <dd>.', - 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol start type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>.', + 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>.', 'The following tag(s) were added to Limit allowed HTML tags and correct faulty HTML, because they are needed to provide fundamental CKEditor 5 functionality : <br> <p>.', ], ], @@ -865,6 +876,10 @@ class SmartDefaultSettingsTest extends KernelTestBase { 'ckeditor5_imageResize' => [ 'allow_resize' => TRUE, ], + 'ckeditor5_list' => [ + 'reversed' => TRUE, + 'startIndex' => TRUE, + ], 'ckeditor5_sourceEditing' => [ 'allowed_tags' => [], ], @@ -914,7 +929,7 @@ class SmartDefaultSettingsTest extends KernelTestBase { '', '
', '', - '
', + '
', '
', '
', '
', @@ -922,6 +937,10 @@ class SmartDefaultSettingsTest extends KernelTestBase { '
', ], ], + 'ckeditor5_list' => [ + 'reversed' => FALSE, + 'startIndex' => TRUE, + ], ], ], 'expected_superset' => '
', @@ -932,7 +951,7 @@ class SmartDefaultSettingsTest extends KernelTestBase { 'status' => [ 'The following plugins were enabled to support tags that are allowed by this text format: Link (for tags: <a>) Block quote (for tags: <blockquote>) Code (for tags: <code>) List (for tags: <ul><ol><li>).', 'The following tags were permitted by this format\'s filter configuration, but no plugin was available that supports them. To ensure the tags remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <cite> <dl> <dt> <dd>.', - 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol start type="1 A I"> <h2 id="jump-*"> <h3 id> <h4 id> <h5 id> <h6 id>.', + 'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s Manually editable HTML tags: <a hreflang> <blockquote cite> <ul type> <ol type="1 A I"> <h2 id="jump-*"> <h3 id> <h4 id> <h5 id> <h6 id>.', 'The following tag(s) were added to Limit allowed HTML tags and correct faulty HTML, because they are needed to provide fundamental CKEditor 5 functionality : <br> <p>.', ], ], diff --git a/core/modules/ckeditor5/tests/src/Kernel/ValidatorsTest.php b/core/modules/ckeditor5/tests/src/Kernel/ValidatorsTest.php index 2ac92a5cb8b..58ba428236d 100644 --- a/core/modules/ckeditor5/tests/src/Kernel/ValidatorsTest.php +++ b/core/modules/ckeditor5/tests/src/Kernel/ValidatorsTest.php @@ -128,7 +128,12 @@ class ValidatorsTest extends KernelTestBase { 'foobar', ], ], - 'plugins' => [], + 'plugins' => [ + 'ckeditor5_list' => [ + 'reversed' => FALSE, + 'startIndex' => FALSE, + ], + ], ], 'violations' => [ 'settings.toolbar.items.5' => 'The provided toolbar item foobar is not valid.', diff --git a/core/modules/ckeditor5/tests/src/Unit/ListPluginTest.php b/core/modules/ckeditor5/tests/src/Unit/ListPluginTest.php new file mode 100644 index 00000000000..7825ceaa512 --- /dev/null +++ b/core/modules/ckeditor5/tests/src/Unit/ListPluginTest.php @@ -0,0 +1,102 @@ + [ + [ + 'reversed' => TRUE, + 'startIndex' => FALSE, + ], + [ + 'list' => [ + 'properties' => [ + 'reversed' => TRUE, + 'startIndex' => FALSE, + 'styles' => FALSE, + ], + ], + ], + ], + 'reversed is false' => [ + [ + 'reversed' => FALSE, + 'startIndex' => TRUE, + ], + [ + 'list' => [ + 'properties' => [ + 'reversed' => FALSE, + 'startIndex' => TRUE, + 'styles' => FALSE, + ], + ], + ], + ], + 'both disabled' => [ + [ + 'reversed' => FALSE, + 'startIndex' => FALSE, + ], + [ + 'list' => [ + 'properties' => [ + 'reversed' => FALSE, + 'startIndex' => FALSE, + 'styles' => FALSE, + ], + ], + ], + ], + 'both enabled' => [ + [ + 'reversed' => TRUE, + 'startIndex' => TRUE, + ], + [ + 'list' => [ + 'properties' => [ + 'reversed' => TRUE, + 'startIndex' => TRUE, + 'styles' => FALSE, + ], + ], + ], + ], + ]; + } + + /** + * @covers ::getDynamicPluginConfig + * + * @dataProvider providerGetDynamicPluginConfig + */ + public function testGetDynamicPluginConfig(array $configuration, array $expected_dynamic_config): void { + // Read the CKEditor 5 plugin's static configuration from YAML. + $ckeditor5_plugin_definitions = Yaml::parseFile(__DIR__ . '/../../../ckeditor5.ckeditor5.yml'); + $static_plugin_config = $ckeditor5_plugin_definitions['ckeditor5_list']['ckeditor5']['config']; + $plugin = new ListPlugin($configuration, 'ckeditor5_list', NULL); + $dynamic_plugin_config = $plugin->getDynamicPluginConfig($static_plugin_config, $this->prophesize(Editor::class) + ->reveal()); + $this->assertSame($expected_dynamic_config, $dynamic_plugin_config); + } + +}