From e29de521447ff9a6806e7acdb52a1ebf6dba2388 Mon Sep 17 00:00:00 2001 From: Imanol Eguskiza Date: Wed, 28 Jul 2021 16:07:08 +0200 Subject: [PATCH] EWPP-1354: Replace the ecl-editor class. --- .../oe-theme-content-event-summary.html.twig | 2 +- oe_theme.info.yml | 1 - oe_theme.libraries.yml | 9 +++------ package.json | 3 --- sass/components/_global.scss | 2 +- sass/components/_wysiwyg.scss | 2 +- templates/field/description-list.html.twig | 2 +- ...field--node--body--oe-project--full.html.twig | 2 +- ...-oe-consultation-closed-status-text.html.twig | 2 +- ...on-biography-intro--oe-person--full.html.twig | 2 +- ...on-interests-intro--oe-person--full.html.twig | 2 +- ...transparency-intro--oe-person--full.html.twig | 2 +- ...oe-person-job--oe-description--full.html.twig | 2 +- ...ield--oe-person-job--oe-description.html.twig | 2 +- templates/field/field--text-long.html.twig | 2 +- .../pattern-text-featured-media.html.twig | 2 +- tests/Functional/ConfigurationTest.php | 14 ++++++-------- .../ContentCallForProposalsRenderTest.php | 2 +- .../ContentCallForTendersRenderTest.php | 2 +- .../Functional/ContentConsultationRenderTest.php | 16 ++++++++-------- tests/Functional/ContentEventRenderTest.php | 2 +- tests/Functional/ContentNewsRenderTest.php | 2 +- .../Functional/ContentOrganisationRenderTest.php | 2 +- tests/Functional/ContentPersonRenderTest.php | 12 ++++++------ .../Functional/ContentPublicationRenderTest.php | 2 +- tests/Functional/ContentRenderTestBase.php | 2 +- tests/Kernel/ContactRenderTest.php | 6 +++--- tests/Kernel/LegacyContentRenderTest.php | 4 ++-- tests/Kernel/Paragraphs/ContactParagraphTest.php | 4 ++-- tests/Kernel/Paragraphs/ParagraphsTest.php | 16 ++++++++-------- tests/Kernel/fixtures/rendering.yml | 12 ++++++------ .../TextFeaturedMediaAssert.php | 2 +- 32 files changed, 65 insertions(+), 74 deletions(-) diff --git a/modules/oe_theme_content_event/templates/oe-theme-content-event-summary.html.twig b/modules/oe_theme_content_event/templates/oe-theme-content-event-summary.html.twig index 6aa844ae1f..9e6f288b92 100644 --- a/modules/oe_theme_content_event/templates/oe-theme-content-event-summary.html.twig +++ b/modules/oe_theme_content_event/templates/oe-theme-content-event-summary.html.twig @@ -5,7 +5,7 @@ */ #} {% if text is not empty %} -
+
{{ text }}
{% endif %} diff --git a/oe_theme.info.yml b/oe_theme.info.yml index 4c7b241633..3669493bc8 100644 --- a/oe_theme.info.yml +++ b/oe_theme.info.yml @@ -7,7 +7,6 @@ core: 8.x base theme: stable libraries: - - oe_theme/editor - oe_theme/external_svg - oe_theme/print diff --git a/oe_theme.libraries.yml b/oe_theme.libraries.yml index 5b4649ea5d..65dc4f35c7 100644 --- a/oe_theme.libraries.yml +++ b/oe_theme.libraries.yml @@ -1,9 +1,10 @@ -component_library_ec: +./vendor/bin/run toolkit:build-devcomponent_library_ec: css: theme: dist/preset-reset/styles/optional/ecl-reset.css: { media: screen } dist/ec/styles/ecl-ec.css: { media: screen } dist/ec/styles/ecl-ec-print.css: { media: print } + dist/ec/styles/optional/ecl-ec-default.css: { media: screen } css/style-ec.css: { media: screen } js: dist/js/moment.min.js: { minified: true } @@ -18,6 +19,7 @@ component_library_eu: dist/preset-reset/styles/optional/ecl-reset.css: { media: screen } dist/eu/styles/ecl-eu.css: { media: screen } dist/eu/styles/ecl-eu-print.css: { media: print } + dist/eu/styles/optional/ecl-eu-default.css: { media: screen } css/style-eu.css: { media: screen } js: dist/js/moment.min.js: { minified: true } @@ -26,11 +28,6 @@ component_library_eu: dependencies: - core/drupal -editor: - css: - theme: - dist/styles/ecl-ec-preset-editor.css: {} - external_svg: js: dist/js/svg4everybody.min.js: { minified: true } diff --git a/package.json b/package.json index 61bd16f1b8..c528fd4730 100644 --- a/package.json +++ b/package.json @@ -55,9 +55,6 @@ "@ecl/preset-reset": "3.0.0-beta.2", "@ecl/preset-ec": "3.0.0-beta.2", "@ecl/preset-eu": "3.0.0-beta.2", - "@ecl/ec-component-form-help-block": "2.37.0", - "@ecl/eu-component-form-help-block": "2.37.0", - "@ecl/ec-preset-editor": "2.37.0", "@ecl/theme-ec": "3.0.0-beta.2", "@ecl/theme-eu": "3.0.0-beta.2", "@ecl/vanilla-utility-background": "3.0.0-beta.2", diff --git a/sass/components/_global.scss b/sass/components/_global.scss index 197a7407d2..93a97c37e6 100644 --- a/sass/components/_global.scss +++ b/sass/components/_global.scss @@ -17,7 +17,7 @@ a { color: map.get(theme.$color, 'blue'); } -.ecl-editor { +.ecl { p:first-child { margin-top: 0; } diff --git a/sass/components/_wysiwyg.scss b/sass/components/_wysiwyg.scss index 8647f5893c..12d714a5e4 100644 --- a/sass/components/_wysiwyg.scss +++ b/sass/components/_wysiwyg.scss @@ -1,6 +1,6 @@ @use "sass:map"; @use '@ecl/theme-dev/theme'; -.ecl-editor { +.ecl { article, .ecl-file { margin-top: map.get(theme.$spacing, 'xs'); diff --git a/templates/field/description-list.html.twig b/templates/field/description-list.html.twig index c439e527af..e55114dadd 100755 --- a/templates/field/description-list.html.twig +++ b/templates/field/description-list.html.twig @@ -12,7 +12,7 @@ {% if items %} {% for _item in items %} {% set _description %} -
{{ _item.description }}
+
{{ _item.description }}
{% endset %} {% set _items = _items|merge([{ term: _item.term, diff --git a/templates/field/field--node--body--oe-project--full.html.twig b/templates/field/field--node--body--oe-project--full.html.twig index 92f3d92256..2632175594 100644 --- a/templates/field/field--node--body--oe-project--full.html.twig +++ b/templates/field/field--node--body--oe-project--full.html.twig @@ -7,7 +7,7 @@ */ #} {% for item in items %} -
+
{{ item.content }}
{% endfor %} diff --git a/templates/field/field--node--extra-field-oe-consultation-closed-status-text.html.twig b/templates/field/field--node--extra-field-oe-consultation-closed-status-text.html.twig index 37047fbcbf..f6fe09ea54 100644 --- a/templates/field/field--node--extra-field-oe-consultation-closed-status-text.html.twig +++ b/templates/field/field--node--extra-field-oe-consultation-closed-status-text.html.twig @@ -6,6 +6,6 @@ * @see ./templates/field/field--bare.html.twig */ #} -
+
{%- include 'field--bare.html.twig' -%}
diff --git a/templates/field/field--node--oe-person-biography-intro--oe-person--full.html.twig b/templates/field/field--node--oe-person-biography-intro--oe-person--full.html.twig index 9054027257..12415089f1 100644 --- a/templates/field/field--node--oe-person-biography-intro--oe-person--full.html.twig +++ b/templates/field/field--node--oe-person-biography-intro--oe-person--full.html.twig @@ -7,7 +7,7 @@ */ #} {% for item in items %} -
+
{{ item.content }}
{% endfor %} diff --git a/templates/field/field--node--oe-person-interests-intro--oe-person--full.html.twig b/templates/field/field--node--oe-person-interests-intro--oe-person--full.html.twig index 41d4426dd6..6fa4d23c9f 100644 --- a/templates/field/field--node--oe-person-interests-intro--oe-person--full.html.twig +++ b/templates/field/field--node--oe-person-interests-intro--oe-person--full.html.twig @@ -7,7 +7,7 @@ */ #} {% for item in items %} -
+
{{ item.content }}
{% endfor %} diff --git a/templates/field/field--node--oe-person-transparency-intro--oe-person--full.html.twig b/templates/field/field--node--oe-person-transparency-intro--oe-person--full.html.twig index 474e12d105..0fe382821c 100644 --- a/templates/field/field--node--oe-person-transparency-intro--oe-person--full.html.twig +++ b/templates/field/field--node--oe-person-transparency-intro--oe-person--full.html.twig @@ -7,7 +7,7 @@ */ #} {% for item in items %} -
+
{{ item.content }}
{% endfor %} diff --git a/templates/field/field--oe-person-job--oe-description--full.html.twig b/templates/field/field--oe-person-job--oe-description--full.html.twig index 8be8fcfdef..08eacd6818 100644 --- a/templates/field/field--oe-person-job--oe-description--full.html.twig +++ b/templates/field/field--oe-person-job--oe-description--full.html.twig @@ -7,7 +7,7 @@ */ #} {% for item in items %} -
+
{{ item.content }}
{% endfor %} diff --git a/templates/field/field--oe-person-job--oe-description.html.twig b/templates/field/field--oe-person-job--oe-description.html.twig index 897af4a75d..013966a9b6 100644 --- a/templates/field/field--oe-person-job--oe-description.html.twig +++ b/templates/field/field--oe-person-job--oe-description.html.twig @@ -7,7 +7,7 @@ */ #} {% for item in items %} -
+
{{ item.content }}
{% endfor %} diff --git a/templates/field/field--text-long.html.twig b/templates/field/field--text-long.html.twig index 875009c918..38d352e0ce 100644 --- a/templates/field/field--text-long.html.twig +++ b/templates/field/field--text-long.html.twig @@ -17,7 +17,7 @@ %} {{ label }}
{% endif %} -
+
{%- include 'field--bare.html.twig' -%}
{% endspaceless %} diff --git a/templates/patterns/text_featured_media/pattern-text-featured-media.html.twig b/templates/patterns/text_featured_media/pattern-text-featured-media.html.twig index 7801f06005..b8141fefd1 100644 --- a/templates/patterns/text_featured_media/pattern-text-featured-media.html.twig +++ b/templates/patterns/text_featured_media/pattern-text-featured-media.html.twig @@ -35,7 +35,7 @@
{% endif %} {% if text %} -
{{ text }}
+
{{ text }}
{% endif %}
{% endif %} diff --git a/tests/Functional/ConfigurationTest.php b/tests/Functional/ConfigurationTest.php index f98b449c19..510dcddcdb 100755 --- a/tests/Functional/ConfigurationTest.php +++ b/tests/Functional/ConfigurationTest.php @@ -49,6 +49,7 @@ public function testDefaultLibraryLoading(): void { $this->assertLinkContainsHref('/oe_theme/dist/preset-reset/styles/optional/ecl-reset.css'); $this->assertLinkContainsHref('/oe_theme/dist/ec/styles/ecl-ec.css'); $this->assertLinkContainsHref('/oe_theme/dist/ec/styles/ecl-ec-print.css'); + $this->assertLinkContainsHref('/oe_theme/dist/ec/styles/optional/ecl-ec-default.css'); $this->assertLinkContainsHref('/oe_theme/css/style-ec.css'); $this->assertScriptContainsSrc('/oe_theme/dist/js/moment.min.js'); @@ -58,12 +59,10 @@ public function testDefaultLibraryLoading(): void { // Assert that we do not load the EU component library by default. $this->assertLinkNotContainsHref('/oe_theme/dist/eu/styles/ecl-eu.css'); $this->assertLinkNotContainsHref('/oe_theme/dist/eu/styles/ecl-eu-print.css'); + $this->assertLinkNotContainsHref('/oe_theme/dist/eu/styles/optional/ecl-eu-default.css'); $this->assertLinkNotContainsHref('/oe_theme/css/style-eu.css'); $this->assertScriptNotContainsSrc('/oe_theme/dist/eu/scripts/ecl-eu.js'); - - // Assert that the ECL Editor preset is always loaded. - $this->assertLinkContainsHref('/oe_theme/dist/styles/ecl-ec-preset-editor.css'); } } @@ -101,6 +100,7 @@ public function testChangeComponentLibrary(): void { $this->assertLinkContainsHref('/oe_theme/dist/preset-reset/styles/optional/ecl-reset.css'); $this->assertLinkContainsHref('/oe_theme/dist/eu/styles/ecl-eu.css'); $this->assertLinkContainsHref('/oe_theme/dist/eu/styles/ecl-eu-print.css'); + $this->assertLinkContainsHref('/oe_theme/dist/eu/styles/optional/ecl-eu-default.css'); $this->assertLinkContainsHref('/oe_theme/css/style-eu.css'); $this->assertScriptContainsSrc('/oe_theme/dist/js/moment.min.js'); @@ -113,13 +113,11 @@ public function testChangeComponentLibrary(): void { // Assert that we do not load the EC component library. $this->assertLinkNotContainsHref('/oe_theme/dist/ec/styles/ecl-ec.css'); $this->assertLinkNotContainsHref('/oe_theme/dist/ec/styles/ecl-ec-print.css'); + $this->assertLinkNotContainsHref('/oe_theme/dist/ec/styles/optional/ecl-ec-default.css'); $this->assertLinkNotContainsHref('/oe_theme/css/style-ec.css'); $this->assertScriptNotContainsSrc('/oe_theme/dist/ec/scripts/ecl-ec.js'); - // Assert that the ECL Editor preset is always loaded. - $this->assertLinkContainsHref('/oe_theme/dist/styles/ecl-ec-preset-editor.css'); - // Visit theme administration page. $this->drupalGet('/admin/appearance/settings/' . $active_theme); @@ -133,6 +131,7 @@ public function testChangeComponentLibrary(): void { // Assert that we load the EC component library by default. $this->assertLinkContainsHref('/oe_theme/dist/ec/styles/ecl-ec.css'); $this->assertLinkContainsHref('/oe_theme/dist/ec/styles/ecl-ec-print.css'); + $this->assertLinkContainsHref('/oe_theme/dist/ec/styles/optional/ecl-ec-default.css'); $this->assertLinkContainsHref('/oe_theme/css/style-ec.css'); $this->assertScriptContainsSrc('/oe_theme/dist/ec/scripts/ecl-ec.js'); @@ -145,12 +144,11 @@ public function testChangeComponentLibrary(): void { // Assert that we do not load the EU component library by default. $this->assertLinkNotContainsHref('/oe_theme/dist/eu/styles/ecl-eu.css'); $this->assertLinkNotContainsHref('/oe_theme/dist/eu/styles/ecl-eu-print.css'); + $this->assertLinkNotContainsHref('/oe_theme/dist/eu/styles/optional/ecl-eu-default.css'); $this->assertLinkNotContainsHref('/oe_theme/css/style-eu.css'); $this->assertScriptNotContainsSrc('/oe_theme/dist/eu/scripts/ecl-eu.js'); - // Assert that the ECL Editor preset is always loaded. - $this->assertLinkContainsHref('/oe_theme/dist/styles/ecl-ec-preset-editor.css'); } } diff --git a/tests/Functional/ContentCallForProposalsRenderTest.php b/tests/Functional/ContentCallForProposalsRenderTest.php index e46b8a2ba2..cd43d27448 100644 --- a/tests/Functional/ContentCallForProposalsRenderTest.php +++ b/tests/Functional/ContentCallForProposalsRenderTest.php @@ -349,7 +349,7 @@ public function testProposalRendering(): void { $content_items = $content->findAll('xpath', '/div'); $this->assertCount(2, $content_items); $this->assertContentHeader($content_items[1], 'Description', 'description'); - $content_second_group = $content_items[1]->find('css', '.ecl-editor p'); + $content_second_group = $content_items[1]->find('css', '.ecl p'); $this->assertEquals('Call for proposals body', $content_second_group->getText()); // Assert Documents field. diff --git a/tests/Functional/ContentCallForTendersRenderTest.php b/tests/Functional/ContentCallForTendersRenderTest.php index 240836ccbb..70ea92acaf 100644 --- a/tests/Functional/ContentCallForTendersRenderTest.php +++ b/tests/Functional/ContentCallForTendersRenderTest.php @@ -271,7 +271,7 @@ public function testTenderRendering(): void { $content_items = $content->findAll('xpath', '/div'); $this->assertCount(2, $content_items); $this->assertContentHeader($content_items[1], 'Description', 'description'); - $content_second_group = $content_items[1]->find('css', '.ecl-editor p'); + $content_second_group = $content_items[1]->find('css', '.ecl p'); $this->assertEquals('Call for tenders body', $content_second_group->getText()); // Assert Documents field. diff --git a/tests/Functional/ContentConsultationRenderTest.php b/tests/Functional/ContentConsultationRenderTest.php index b4df5d2fbd..7ae33f276c 100644 --- a/tests/Functional/ContentConsultationRenderTest.php +++ b/tests/Functional/ContentConsultationRenderTest.php @@ -202,7 +202,7 @@ public function testConsultationRendering(): void { $field_list_assert->assertPattern($details_expected_values, $details_html); // Assert 2nd inpage navigation item content. - $content_second_group = $content_items[1]->find('css', '.ecl-editor p'); + $content_second_group = $content_items[1]->find('css', '.ecl p'); $this->assertEquals('Target audience text', $content_second_group->getText()); // Set Consultation aim and assert navigation and content is updated. @@ -220,7 +220,7 @@ public function testConsultationRendering(): void { $inpage_nav_assert->assertPattern($inpage_nav_expected_values, $navigation->getOuterHtml()); $content_items = $content->findAll('xpath', '/div'); $this->assertCount(3, $content_items); - $content_second_group = $content_items[2]->find('css', '.ecl-editor p'); + $content_second_group = $content_items[2]->find('css', '.ecl p'); $this->assertEquals('Consultation aim text', $content_second_group->getText()); // Set Consultation guidelines and assert navigation and content is updated. @@ -251,7 +251,7 @@ public function testConsultationRendering(): void { $inpage_nav_assert->assertPattern($inpage_nav_expected_values, $navigation->getOuterHtml()); $content_items = $content->findAll('xpath', '/div'); $this->assertCount(4, $content_items); - $content_second_group = $content_items[3]->find('css', '.ecl-editor p'); + $content_second_group = $content_items[3]->find('css', '.ecl p'); $this->assertEquals('Consultation guidelines text', $content_second_group->getText()); $this->assertElementNotPresent('.ecl-link.ecl-link--cta'); @@ -290,7 +290,7 @@ public function testConsultationRendering(): void { $inpage_nav_assert->assertPattern($inpage_nav_expected_values, $navigation->getOuterHtml()); $content_items = $content->findAll('xpath', '/div'); $this->assertCount(5, $content_items); - $content_second_group = $content_items[4]->find('css', '.ecl-editor p'); + $content_second_group = $content_items[4]->find('css', '.ecl p'); $this->assertEquals('Consultation outcome text', $content_second_group->getText()); $this->assertMediaDocumentDefaultRender($content_items[4], 'consultation_document', 'English', '2.96 KB - PDF', "sample_consultation_document.pdf", 'Download'); @@ -383,7 +383,7 @@ public function testConsultationRendering(): void { $inpage_nav_assert->assertPattern($inpage_nav_expected_values, $navigation->getOuterHtml()); $content_items = $content->findAll('xpath', '/div'); $this->assertCount(7, $content_items); - $content_second_group = $content_items[6]->find('css', '.ecl-editor p'); + $content_second_group = $content_items[6]->find('css', '.ecl p'); $this->assertEquals('Additional information text', $content_second_group->getText()); // Set legal notice and assert content is updated. @@ -430,7 +430,7 @@ public function testConsultationRendering(): void { $inpage_nav_assert->assertPattern($inpage_nav_expected_values, $navigation->getOuterHtml()); $content_items = $content->findAll('xpath', '/div'); $this->assertCount(8, $content_items); - $content_second_group = $content_items[7]->find('css', '.ecl-editor p'); + $content_second_group = $content_items[7]->find('css', '.ecl p'); $this->assertEquals('Legal info text', $content_second_group->getText()); // Set contact and assert content is updated. @@ -544,7 +544,7 @@ public function testConsultationRendering(): void { ]; $page_header_assert->assertPattern($page_header_expected_values, $page_header->getOuterHtml()); - $content_second_group = $content_items[3]->find('css', '.ecl-editor'); + $content_second_group = $content_items[3]->find('css', '.ecl'); $this->assertEquals('Consultation guidelines text', $content_second_group->getText()); $this->assertNotContains('The response period for this consultation has ended. Thank you for your input.', $content_second_group->getText()); @@ -582,7 +582,7 @@ public function testConsultationRendering(): void { // Assert 4th inpage navigation item content is updated. $this->assertContentHeader($content_items[3], 'Respond to the consultation', 'respond-to-the-consultation'); - $content_second_group = $content_items[3]->find('css', '.ecl-editor'); + $content_second_group = $content_items[3]->find('css', '.ecl'); // Assert default value for closed status text. $this->assertEquals('The response period for this consultation has ended. Thank you for your input.', $content_second_group->getText()); $this->assertElementNotPresent('.ecl-link.ecl-link--cta'); diff --git a/tests/Functional/ContentEventRenderTest.php b/tests/Functional/ContentEventRenderTest.php index 6e5cac2cf0..04da50d817 100644 --- a/tests/Functional/ContentEventRenderTest.php +++ b/tests/Functional/ContentEventRenderTest.php @@ -507,7 +507,7 @@ public function testEventRendering(): void { $this->cronRun(); $this->drupalGet($node->toUrl()); - $description_summary = $this->assertSession()->elementExists('css', '.ecl-editor', $details_content); + $description_summary = $this->assertSession()->elementExists('css', '.ecl', $details_content); $this->assertEquals('Event report summary', $description_summary->getText()); $text_featured_expected_values['title'] = 'Report'; diff --git a/tests/Functional/ContentNewsRenderTest.php b/tests/Functional/ContentNewsRenderTest.php index 2b97d3c51f..6b92cdfdcf 100644 --- a/tests/Functional/ContentNewsRenderTest.php +++ b/tests/Functional/ContentNewsRenderTest.php @@ -137,7 +137,7 @@ public function testNewsRendering(): void { $field_list_assert->assertPattern($details_expected_values, $details_html); // Assert Body field. - $body = $this->assertSession()->elementExists('css', 'article[role=article] .ecl-editor'); + $body = $this->assertSession()->elementExists('css', 'article[role=article] .ecl'); $this->assertEquals('News body', $body->getText()); // Assert news contacts. diff --git a/tests/Functional/ContentOrganisationRenderTest.php b/tests/Functional/ContentOrganisationRenderTest.php index 2970669a27..c2b0f2f57d 100644 --- a/tests/Functional/ContentOrganisationRenderTest.php +++ b/tests/Functional/ContentOrganisationRenderTest.php @@ -192,7 +192,7 @@ public function testOrganisationRendering(): void { $this->assertEquals('Overview Description 2', $overview_descriptions[1]->getText()); // Assert values of the second group. - $body = $content_items[1]->findAll('css', '.ecl-editor'); + $body = $content_items[1]->findAll('css', '.ecl'); $this->assertCount(1, $body); $this->assertEquals('My body text', $body[0]->getText()); diff --git a/tests/Functional/ContentPersonRenderTest.php b/tests/Functional/ContentPersonRenderTest.php index 00ff14db3f..8b164a01c6 100644 --- a/tests/Functional/ContentPersonRenderTest.php +++ b/tests/Functional/ContentPersonRenderTest.php @@ -234,7 +234,7 @@ public function testPersonRendering(): void { $this->assertContentHeader($content_items[2], 'Responsibilities', 'responsibilities'); $job_role_content = $content_items[2]->find('css', 'h3.ecl-u-type-heading-3.ecl-u-mt-none.ecl-u-mb-s'); $this->assertEquals('(Acting) Advisor', $job_role_content->getText()); - $job_description_content = $content_items[2]->find('css', 'div.ecl-u-mb-l.ecl-editor'); + $job_description_content = $content_items[2]->find('css', 'div.ecl-u-mb-l.ecl'); $this->assertEquals('Description job_1', $job_description_content->getText()); // Assert Jobs field with multiple values. @@ -248,7 +248,7 @@ public function testPersonRendering(): void { $content_items = $content->findAll('xpath', '/div'); $job_role_items = $content_items[2]->findAll('css', 'h3.ecl-u-type-heading-3.ecl-u-mt-none.ecl-u-mb-s'); $this->assertEquals('Chief advisor', $job_role_items[1]->getText()); - $job_description_items = $content_items[2]->findAll('css', 'div.ecl-u-mb-l.ecl-editor'); + $job_description_items = $content_items[2]->findAll('css', 'div.ecl-u-mb-l.ecl'); $this->assertEquals('Description job_2', $job_description_items[1]->getText()); // Assert Social media links field. @@ -328,7 +328,7 @@ public function testPersonRendering(): void { $content_items = $content->findAll('xpath', '/div'); $this->assertCount(6, $content_items); $this->assertContentHeader($content_items[5], 'Transparency', 'transparency'); - $transparancy_intro_content = $content_items[5]->find('css', 'div.ecl-editor.ecl-u-mb-m'); + $transparancy_intro_content = $content_items[5]->find('css', 'div.ecl.ecl-u-mb-m'); $this->assertEquals('Transparency introduction text', $transparancy_intro_content->getText()); // Assert Transparency links field. @@ -363,7 +363,7 @@ public function testPersonRendering(): void { $content_items = $content->findAll('xpath', '/div'); $this->assertCount(7, $content_items); $this->assertContentHeader($content_items[6], 'Biography', 'biography'); - $biography_content = $content_items[6]->find('css', 'div.ecl-editor.ecl-u-mb-m'); + $biography_content = $content_items[6]->find('css', 'div.ecl.ecl-u-mb-m'); $this->assertEquals('Biography introduction text', $biography_content->getText()); // Assert Biography field. @@ -413,7 +413,7 @@ public function testPersonRendering(): void { $content_items = $content->findAll('xpath', '/div'); $this->assertEquals('Declaration of interests', $content_items[6]->find('css', 'h3.ecl-u-type-heading-3')->getText()); - $this->assertEquals('Declaration of interests introduction text', $content_items[6]->find('css', 'div.ecl-u-mb-l.ecl-editor')->getText()); + $this->assertEquals('Declaration of interests introduction text', $content_items[6]->find('css', 'div.ecl-u-mb-l.ecl')->getText()); // Assert Declaration of interests file field. $cv_media_document = $this->createMediaDocument('declaration'); @@ -501,7 +501,7 @@ public function testPersonRendering(): void { $job_role_items = $content_items[2]->findAll('css', 'h3.ecl-u-type-heading-3.ecl-u-mt-none.ecl-u-mb-s'); $this->assertEquals('Singer', $job_role_items[0]->getText()); $this->assertEquals('Dancer', $job_role_items[1]->getText()); - $job_description_items = $content_items[2]->findAll('css', 'div.ecl-u-mb-l.ecl-editor'); + $job_description_items = $content_items[2]->findAll('css', 'div.ecl-u-mb-l.ecl'); $this->assertEquals('Description job_1', $job_description_items[0]->getText()); $this->assertEquals('Description job_2', $job_description_items[1]->getText()); diff --git a/tests/Functional/ContentPublicationRenderTest.php b/tests/Functional/ContentPublicationRenderTest.php index a7fa5ba15d..fa1fd28661 100644 --- a/tests/Functional/ContentPublicationRenderTest.php +++ b/tests/Functional/ContentPublicationRenderTest.php @@ -258,7 +258,7 @@ public function testPublicationRendering(): void { $this->assertContentHeader($content_items[1], 'Description', 'description'); $this->assertContentHeader($content_items[2], 'Files', 'files'); - $body = $content_items[1]->findAll('css', '.ecl-row .ecl-col-12.ecl-col-m-9 .ecl-editor'); + $body = $content_items[1]->findAll('css', '.ecl-row .ecl-col-12.ecl-col-m-9 .ecl'); $this->assertCount(1, $body); $this->assertEquals('Publication body text', $body[0]->getText()); $thumbnail_wrapper_selector = '.ecl-row .ecl-col-12.ecl-col-m-3 figure'; diff --git a/tests/Functional/ContentRenderTestBase.php b/tests/Functional/ContentRenderTestBase.php index 5ecc4afb33..d4c56523e1 100644 --- a/tests/Functional/ContentRenderTestBase.php +++ b/tests/Functional/ContentRenderTestBase.php @@ -244,7 +244,7 @@ protected function assertContactDefaultRender(NodeElement $element, string $name $this->assertCount(1, $contact_name); $this->assertEquals($name, $contact_name[0]->getText()); - $contact_body = $element->findAll('css', '.ecl-editor'); + $contact_body = $element->findAll('css', '.ecl'); $this->assertCount(1, $contact_body); $this->assertEquals("Body text $name", $contact_body[0]->getText()); diff --git a/tests/Kernel/ContactRenderTest.php b/tests/Kernel/ContactRenderTest.php index 5e913b8221..ff1aa1010d 100644 --- a/tests/Kernel/ContactRenderTest.php +++ b/tests/Kernel/ContactRenderTest.php @@ -52,7 +52,7 @@ public function testFullView(): void { $crawler = new Crawler($html); // Assert that empty values don't exist. - $this->assertEmpty($crawler->filter('.ecl-editor')); + $this->assertEmpty($crawler->filter('.ecl')); $this->assertEmpty($crawler->filter('.ecl-description-list')); $this->assertEmpty($crawler->filter('figure.ecl-media-container')); $this->assertEmpty($crawler->filter('.ecl-u-border-top.ecl-u-border-bottom.ecl-u-border-color-grey-15.ecl-u-mt-s.ecl-u-pt-l.ecl-u-pb-l')); @@ -69,7 +69,7 @@ public function testFullView(): void { $build = $this->contactViewBuilder->view($contact, 'full'); $html = $this->renderRoot($build); $crawler = new Crawler($html); - $rendered_body = $crawler->filter('.ecl-col-12 .ecl-editor'); + $rendered_body = $crawler->filter('.ecl-col-12 .ecl'); $this->assertCount(1, $rendered_body); $this->assertEquals("Body text $name", trim($rendered_body->text())); @@ -183,7 +183,7 @@ public function testFullView(): void { $crawler = new Crawler($html); // Ensure that wrapper for body field has been changed. - $rendered_body = $crawler->filter('.ecl-row.ecl-u-mv-xl .ecl-col-m-6 .ecl-editor'); + $rendered_body = $crawler->filter('.ecl-row.ecl-u-mv-xl .ecl-col-m-6 .ecl'); $this->assertCount(1, $rendered_body); $this->assertEquals("Body text $name", trim($rendered_body->text())); diff --git a/tests/Kernel/LegacyContentRenderTest.php b/tests/Kernel/LegacyContentRenderTest.php index 4815efb4f9..b664eaa063 100644 --- a/tests/Kernel/LegacyContentRenderTest.php +++ b/tests/Kernel/LegacyContentRenderTest.php @@ -48,7 +48,7 @@ public function testPage(): void { $this->assertEquals('Test page node', $title->text()); // Body wrapper. - $body_wrapper = $crawler->filter('.ecl-editor'); + $body_wrapper = $crawler->filter('.ecl'); $this->assertCount(1, $body_wrapper); $this->assertContains('Body', $body_wrapper->text()); @@ -90,7 +90,7 @@ public function testPolicy(): void { $this->assertEquals('Test policy node', $title->text()); // Body wrapper. - $body_wrapper = $crawler->filter('.ecl-editor'); + $body_wrapper = $crawler->filter('.ecl'); $this->assertCount(1, $body_wrapper); $this->assertContains('Body', $body_wrapper->text()); diff --git a/tests/Kernel/Paragraphs/ContactParagraphTest.php b/tests/Kernel/Paragraphs/ContactParagraphTest.php index a56f8bc0b6..1ceae1431a 100644 --- a/tests/Kernel/Paragraphs/ContactParagraphTest.php +++ b/tests/Kernel/Paragraphs/ContactParagraphTest.php @@ -137,7 +137,7 @@ public function testContact(): void { $this->assertCount(0, $crawler->filter('h2.ecl-u-type-heading-2')); // Assert rendering of the first contact. $this->assertEquals('General contact', trim($crawler->filter('div.ecl-row.ecl-u-mv-xl:nth-child(1) h3.ecl-u-type-heading-3.ecl-u-mt-none div')->html())); - $this->assertEquals('

General contact body text

', trim($crawler->filter('div.ecl-col-m-6 div.ecl-u-m-l:nth-child(1) div.ecl-editor')->html())); + $this->assertEquals('

General contact body text

', trim($crawler->filter('div.ecl-col-m-6 div.ecl-u-m-l:nth-child(1) div.ecl')->html())); $this->assertEquals('General contact Organisation', trim($crawler->filter('dl.ecl-description-list.ecl-description-list--horizontal:nth-child(2) dd.ecl-description-list__definition:nth-child(2) div')->html())); $this->assertEquals('general@example.com', trim($crawler->filter('dl.ecl-description-list.ecl-description-list--horizontal:nth-child(2) dd.ecl-description-list__definition:nth-child(4) div a')->html())); $this->assertEquals('Address of General contact, 1001 Brussels, Belgium', trim($crawler->filter('dl.ecl-description-list.ecl-description-list--horizontal:nth-child(2) dd.ecl-description-list__definition:nth-child(6) div span')->html())); @@ -145,7 +145,7 @@ public function testContact(): void { $this->assertContains('example_1.jpeg', $crawler->filter('div.ecl-col-m-5 figure.ecl-media-container img')->attr('src')); // Assert rendering of the second contact. $this->assertEquals('Press contact', trim($crawler->filter('div.ecl-row.ecl-u-mv-xl:nth-child(2) h3.ecl-u-type-heading-3.ecl-u-mt-none div')->html())); - $this->assertEquals('

Press contact body text

', trim($crawler->filter('div.ecl-col-12:nth-child(2) div.ecl-u-m-l div.ecl-editor')->html())); + $this->assertEquals('

Press contact body text

', trim($crawler->filter('div.ecl-col-12:nth-child(2) div.ecl-u-m-l div.ecl')->html())); // Set paragraph title and assert rendering is updated. $paragraph->set('field_oe_title', 'Contact paragraph Test')->save(); diff --git a/tests/Kernel/Paragraphs/ParagraphsTest.php b/tests/Kernel/Paragraphs/ParagraphsTest.php index 0d44600670..e0d7796b09 100644 --- a/tests/Kernel/Paragraphs/ParagraphsTest.php +++ b/tests/Kernel/Paragraphs/ParagraphsTest.php @@ -448,7 +448,7 @@ public function testRichText(): void { $html = $this->renderParagraph($paragraph); $crawler = new Crawler($html); - $actual = $crawler->filter('div.ecl-editor p')->html(); + $actual = $crawler->filter('div.ecl p')->html(); $this->assertEquals($body, trim($actual)); // Add a title. @@ -738,15 +738,15 @@ public function testDescriptionList(): void { $this->assertCount(5, $crawler->filter('dt.ecl-description-list__term')); $this->assertCount(5, $crawler->filter('dd.ecl-description-list__definition')); $this->assertEquals('Term 1', trim($crawler->filter('dt.ecl-description-list__term:nth-child(1)')->html())); - $this->assertEquals('

Description 1

', trim($crawler->filter('dd.ecl-description-list__definition:nth-child(2)')->html())); + $this->assertEquals('

Description 1

', trim($crawler->filter('dd.ecl-description-list__definition:nth-child(2)')->html())); $this->assertEquals('Term 2', trim($crawler->filter('dt.ecl-description-list__term:nth-child(3)')->html())); - $this->assertEquals('

<p>Description 2</p>

', trim($crawler->filter('dd.ecl-description-list__definition:nth-child(4)')->html())); + $this->assertEquals('

<p>Description 2</p>

', trim($crawler->filter('dd.ecl-description-list__definition:nth-child(4)')->html())); $this->assertEquals('Term 3', trim($crawler->filter('dt.ecl-description-list__term:nth-child(5)')->html())); - $this->assertEquals('

<p>Description <strong>3</strong></p>

', trim($crawler->filter('dd.ecl-description-list__definition:nth-child(6)')->html())); + $this->assertEquals('

<p>Description <strong>3</strong></p>

', trim($crawler->filter('dd.ecl-description-list__definition:nth-child(6)')->html())); $this->assertEquals('Term 4', trim($crawler->filter('dt.ecl-description-list__term:nth-child(7)')->html())); - $this->assertEquals('
Description 4
', trim($crawler->filter('dd.ecl-description-list__definition:nth-child(8)')->html())); + $this->assertEquals('
Description 4
', trim($crawler->filter('dd.ecl-description-list__definition:nth-child(8)')->html())); $this->assertEquals('Term 5', trim($crawler->filter('dt.ecl-description-list__term:nth-child(9)')->html())); - $this->assertEquals('

Description 5

', trim($crawler->filter('dd.ecl-description-list__definition:nth-child(10)')->html())); + $this->assertEquals('

Description 5

', trim($crawler->filter('dd.ecl-description-list__definition:nth-child(10)')->html())); // Move the last item on the first position. $items = $paragraph->get('field_oe_description_list_items')->getValue(); @@ -759,9 +759,9 @@ public function testDescriptionList(): void { $crawler = new Crawler($html); // Assert the order was updated. $this->assertEquals('Term 5', trim($crawler->filter('dt.ecl-description-list__term:nth-child(1)')->html())); - $this->assertEquals('

Description 5

', trim($crawler->filter('dd.ecl-description-list__definition:nth-child(2)')->html())); + $this->assertEquals('

Description 5

', trim($crawler->filter('dd.ecl-description-list__definition:nth-child(2)')->html())); $this->assertEquals('Term 1', trim($crawler->filter('dt.ecl-description-list__term:nth-child(9)')->html())); - $this->assertEquals('

Description 1

', trim($crawler->filter('dd.ecl-description-list__definition:nth-child(10)')->html())); + $this->assertEquals('

Description 1

', trim($crawler->filter('dd.ecl-description-list__definition:nth-child(10)')->html())); } } diff --git a/tests/Kernel/fixtures/rendering.yml b/tests/Kernel/fixtures/rendering.yml index 15eeb6d601..6368d25e03 100644 --- a/tests/Kernel/fixtures/rendering.yml +++ b/tests/Kernel/fixtures/rendering.yml @@ -2292,7 +2292,7 @@ equals: 'h2.ecl-u-type-heading-2': "Heading" 'figcaption.ecl-media-container__caption': "Some caption text for the image" - 'div.ecl-col-m-6.ecl-editor': "Some more text" + 'div.ecl-col-m-6.ecl': "Some more text" - array: '#type': pattern '#id': text_featured_media @@ -2311,7 +2311,7 @@ 'figcaption.ecl-media-container__caption': 1 equals: 'figcaption.ecl-media-container__caption': "Some caption text for the image" - 'div.ecl-col-m-6.ecl-editor': "Some more text" + 'div.ecl-col-m-6.ecl': "Some more text" - array: '#type': pattern '#id': text_featured_media @@ -2323,13 +2323,13 @@ count: 'div.ecl-row': 1 'figure.ecl-media-container': 0 - 'div.ecl-col-m-6.ecl-editor': 0 + 'div.ecl-col-m-6.ecl': 0 'img.ecl-media-container__media[src="http://via.placeholder.com/150x150"]': 0 'div.ecl-media-container__media--ratio-16-9 iframe': 0 'figcaption.ecl-media-container__caption': 0 equals: 'h2.ecl-u-type-heading-2': "Heading" - 'div.ecl-col-12.ecl-editor': "Some more text" + 'div.ecl-col-12.ecl': "Some more text" - array: '#type': pattern '#id': text_featured_media @@ -2347,7 +2347,7 @@ 'figcaption.ecl-media-container__caption': 0 equals: 'h2.ecl-u-type-heading-2': "Heading" - 'div.ecl-col-m-6.ecl-editor': "Some more text" + 'div.ecl-col-m-6.ecl': "Some more text" - array: '#type': pattern '#id': text_featured_media @@ -2384,7 +2384,7 @@ 'figcaption.ecl-media-container__caption': 0 equals: 'h2.ecl-u-type-heading-2': "Heading" - 'div.ecl-col-m-6.ecl-editor': "Some more text" + 'div.ecl-col-m-6.ecl': "Some more text" - array: '#type': pattern '#id': text_featured_media diff --git a/tests/PatternAssertions/TextFeaturedMediaAssert.php b/tests/PatternAssertions/TextFeaturedMediaAssert.php index 8f58c3bf60..c7804c2e29 100644 --- a/tests/PatternAssertions/TextFeaturedMediaAssert.php +++ b/tests/PatternAssertions/TextFeaturedMediaAssert.php @@ -37,7 +37,7 @@ protected function getAssertions($variant): array { ], 'text' => [ [$this, 'assertElementText'], - 'div.ecl-row > div.ecl-editor', + 'div.ecl-row > div.ecl', ], 'video_ratio' => [ [$this, 'assertVideoRatio'],