From 5fd27445460656faee9955614f044d9b4d48068e Mon Sep 17 00:00:00 2001 From: escuriola Date: Fri, 3 Jun 2022 12:37:12 +0200 Subject: [PATCH] OEL-1618: Removing fw-bold classes and add heading to DescriptionList and ContentRow paragraphs. --- .../tests/src/Kernel/Paragraphs/ContentRowTest.php | 6 +++--- .../tests/src/Kernel/Paragraphs/DescriptionListTest.php | 6 +++--- .../paragraphs/paragraph--oe-description-list.html.twig | 4 +++- templates/paragraphs/paragraph--oe-rich-text.html.twig | 4 +++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/modules/oe_whitelabel_paragraphs/tests/src/Kernel/Paragraphs/ContentRowTest.php b/modules/oe_whitelabel_paragraphs/tests/src/Kernel/Paragraphs/ContentRowTest.php index 79daf6dde..6c5734dee 100644 --- a/modules/oe_whitelabel_paragraphs/tests/src/Kernel/Paragraphs/ContentRowTest.php +++ b/modules/oe_whitelabel_paragraphs/tests/src/Kernel/Paragraphs/ContentRowTest.php @@ -159,9 +159,9 @@ public function testWithInpageNavigationRendering(): void { // Assert the paragraphs where added into the right side column. $content = $crawler->filter('div.col-md-9'); $this->assertCount(1, $content); - $rich_text_title = $content->filter('h4.fw-bold.mb-4'); + $rich_text_title = $content->filter('h2.bcl-heading')->eq(0); $this->assertSame('Title rich text test 1', trim($rich_text_title->text())); - $links_block_title = $content->filter('h2.bcl-heading'); + $links_block_title = $content->filter('h2.bcl-heading')->eq(1); $this->assertSame('Links block test', $links_block_title->text()); $facts_figures = $content->filter('div.bcl-fact-figures--default'); $this->assertStringContainsString('Facts and Figures test', $facts_figures->filter('h2.bcl-heading')->text()); @@ -169,7 +169,7 @@ public function testWithInpageNavigationRendering(): void { $this->assertStringContainsString('Maecenas id urna eleifend', $blockquote_blockquote->text()); $blockquote_footer = $content->filter('figcaption.blockquote-footer'); $this->assertSame('Quote 1', trim($blockquote_footer->text())); - $social_media_title = $content->filter('h2.bcl-heading')->eq(2); + $social_media_title = $content->filter('h2.bcl-heading')->eq(3); $this->assertStringContainsString('Social media block', $social_media_title->text()); $accordion_items = $content->filter('.accordion-item'); $this->assertStringContainsString('Accordion item 1', $accordion_items->eq(0)->text()); diff --git a/modules/oe_whitelabel_paragraphs/tests/src/Kernel/Paragraphs/DescriptionListTest.php b/modules/oe_whitelabel_paragraphs/tests/src/Kernel/Paragraphs/DescriptionListTest.php index b1b1280ad..162a3ed67 100644 --- a/modules/oe_whitelabel_paragraphs/tests/src/Kernel/Paragraphs/DescriptionListTest.php +++ b/modules/oe_whitelabel_paragraphs/tests/src/Kernel/Paragraphs/DescriptionListTest.php @@ -69,12 +69,12 @@ public function testRendering(): void { $html = $this->renderParagraph($paragraph); $crawler = new Crawler($html); - $this->assertCount(1, $crawler->filter('h4')); + $this->assertCount(1, $crawler->filter('h2.bcl-heading')); $this->assertCount(1, $crawler->filter('dl.d-md-grid.grid-3-9')); $this->assertCount(2, $crawler->filter('dd')); $this->assertCount(2, $crawler->filter('dt')); - $title = $crawler->filter('h4.fw-bold.mb-4'); + $title = $crawler->filter('h2.bcl-heading'); $this->assertEquals('Description list paragraph', $title->text()); $term_1 = $crawler->filter('dl > div:nth-child(1) > dt'); @@ -100,7 +100,7 @@ public function testRendering(): void { $html = $this->renderParagraph($paragraph); $crawler = new Crawler($html); - $title = $crawler->filter('h4.fw-bold.mb-4'); + $title = $crawler->filter('h2.bcl-heading'); $this->assertEquals('Description list paragraph', $title->text()); $term_1 = $crawler->filter('dl > dt:nth-child(1)'); diff --git a/templates/paragraphs/paragraph--oe-description-list.html.twig b/templates/paragraphs/paragraph--oe-description-list.html.twig index a78c5d6e4..d10b468d7 100644 --- a/templates/paragraphs/paragraph--oe-description-list.html.twig +++ b/templates/paragraphs/paragraph--oe-description-list.html.twig @@ -8,7 +8,9 @@ #} {% if title is not empty %} -

{{ title }}

+ {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: title, + } only %} {% endif %} {{ pattern('description_list', { diff --git a/templates/paragraphs/paragraph--oe-rich-text.html.twig b/templates/paragraphs/paragraph--oe-rich-text.html.twig index 802465561..3547defac 100644 --- a/templates/paragraphs/paragraph--oe-rich-text.html.twig +++ b/templates/paragraphs/paragraph--oe-rich-text.html.twig @@ -6,5 +6,7 @@ * @see ./modules/contrib/paragraphs/templates/paragraph.html.twig */ #} -

{{ content.field_oe_title }}

+{% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: content.field_oe_title, +} only %} {{ content|without('field_oe_title') }}