From d1b42ce7bb2a39be868b8ff6e6efccd407ec6f88 Mon Sep 17 00:00:00 2001 From: 22Alexandra Date: Mon, 26 Feb 2024 11:16:45 +0200 Subject: [PATCH 1/2] EWPP-4069: Use vertical lists variant for all the teaser displays. --- templates/content/node--oe-call-proposals--teaser.html.twig | 1 + templates/content/node--oe-call-tenders--teaser.html.twig | 1 + templates/content/node--oe-consultation--teaser.html.twig | 1 + templates/content/node--oe-event--teaser.html.twig | 1 + templates/content/node--oe-news--teaser.html.twig | 1 + templates/content/node--oe-organisation--teaser.html.twig | 1 + templates/content/node--oe-page--teaser.html.twig | 1 + templates/content/node--oe-person--teaser.html.twig | 1 + templates/content/node--oe-policy--teaser.html.twig | 1 + templates/content/node--oe-project--teaser.html.twig | 1 + templates/content/node--oe-publication--teaser.html.twig | 1 + 11 files changed, 11 insertions(+) diff --git a/templates/content/node--oe-call-proposals--teaser.html.twig b/templates/content/node--oe-call-proposals--teaser.html.twig index a59b2667a..eb651b64b 100644 --- a/templates/content/node--oe-call-proposals--teaser.html.twig +++ b/templates/content/node--oe-call-proposals--teaser.html.twig @@ -24,6 +24,7 @@ 'url': url, 'title': content.extra_field_oe_theme_helper_short_title_with_fallback|field_value, 'lists': additional_information, + 'lists_variant': 'vertical', 'badges': badges, 'external_link': external_link }) }} diff --git a/templates/content/node--oe-call-tenders--teaser.html.twig b/templates/content/node--oe-call-tenders--teaser.html.twig index e8a2d06fc..d244be6c4 100644 --- a/templates/content/node--oe-call-tenders--teaser.html.twig +++ b/templates/content/node--oe-call-tenders--teaser.html.twig @@ -24,6 +24,7 @@ 'url': url, 'title': content.extra_field_oe_theme_helper_short_title_with_fallback|field_value, 'lists': additional_information, + 'lists_variant': 'vertical', 'badges': badges, 'external_link': external_link }) }} diff --git a/templates/content/node--oe-consultation--teaser.html.twig b/templates/content/node--oe-consultation--teaser.html.twig index 25cfa06e3..9bb4461cd 100644 --- a/templates/content/node--oe-consultation--teaser.html.twig +++ b/templates/content/node--oe-consultation--teaser.html.twig @@ -24,6 +24,7 @@ 'url': url, 'title': content.extra_field_oe_theme_helper_short_title_with_fallback|field_value, 'lists': additional_information, + 'lists_variant': 'vertical', 'badges': badges, 'external_link': external_link }) }} diff --git a/templates/content/node--oe-event--teaser.html.twig b/templates/content/node--oe-event--teaser.html.twig index 928705972..6d3e166df 100644 --- a/templates/content/node--oe-event--teaser.html.twig +++ b/templates/content/node--oe-event--teaser.html.twig @@ -20,6 +20,7 @@ 'meta': content.extra_field_oe_theme_content_event_teaser_meta|field_value, 'detail': detail, 'lists': additional_information, + 'lists_variant': 'vertical', 'badges': badges, 'external_link': external_link }) }} diff --git a/templates/content/node--oe-news--teaser.html.twig b/templates/content/node--oe-news--teaser.html.twig index a7cd314df..544209d90 100644 --- a/templates/content/node--oe-news--teaser.html.twig +++ b/templates/content/node--oe-news--teaser.html.twig @@ -24,6 +24,7 @@ 'detail': detail, 'image': image_url ? { 'src': image_url }, 'lists': additional_information, + 'lists_variant': 'vertical', 'badges': badges, 'external_link': external_link }) }} diff --git a/templates/content/node--oe-organisation--teaser.html.twig b/templates/content/node--oe-organisation--teaser.html.twig index 48af04ee7..576f6e23a 100644 --- a/templates/content/node--oe-organisation--teaser.html.twig +++ b/templates/content/node--oe-organisation--teaser.html.twig @@ -31,6 +31,7 @@ 'title': content.extra_field_oe_theme_helper_short_title_with_fallback|field_value, 'detail': content.oe_teaser|field_value, 'lists': additional_information, + 'lists_variant': 'vertical', 'image': image_url ? { 'src': image_url }, 'badges': badges, 'external_link': external_link diff --git a/templates/content/node--oe-page--teaser.html.twig b/templates/content/node--oe-page--teaser.html.twig index f255623ac..230d4fd59 100644 --- a/templates/content/node--oe-page--teaser.html.twig +++ b/templates/content/node--oe-page--teaser.html.twig @@ -11,6 +11,7 @@ 'title': content.extra_field_oe_theme_helper_short_title_with_fallback|field_value, 'detail': content.oe_teaser|field_value, 'lists': additional_information|default([]), + 'lists_variant': 'vertical', 'badges': badges, 'external_link': external_link }) }} diff --git a/templates/content/node--oe-person--teaser.html.twig b/templates/content/node--oe-person--teaser.html.twig index 02720d246..4a47ff134 100644 --- a/templates/content/node--oe-person--teaser.html.twig +++ b/templates/content/node--oe-person--teaser.html.twig @@ -54,6 +54,7 @@ 'title': label, 'detail': content.oe_teaser|field_value, 'lists': additional_information, + 'lists_variant': 'vertical', 'image': content.portrait_image ? { 'src': content.portrait_image|render }, 'badges': badges, 'external_link': external_link diff --git a/templates/content/node--oe-policy--teaser.html.twig b/templates/content/node--oe-policy--teaser.html.twig index d86de6766..85f003c80 100644 --- a/templates/content/node--oe-policy--teaser.html.twig +++ b/templates/content/node--oe-policy--teaser.html.twig @@ -11,6 +11,7 @@ 'title': content.extra_field_oe_theme_helper_short_title_with_fallback|field_value, 'detail': content.oe_teaser|field_value, 'lists': additional_information|default([]), + 'lists_variant': 'vertical', 'badges': badges, 'external_link': external_link }) }} diff --git a/templates/content/node--oe-project--teaser.html.twig b/templates/content/node--oe-project--teaser.html.twig index 9859260fa..f74a0e262 100644 --- a/templates/content/node--oe-project--teaser.html.twig +++ b/templates/content/node--oe-project--teaser.html.twig @@ -24,6 +24,7 @@ 'title': content.extra_field_oe_theme_helper_short_title_with_fallback|field_value, 'detail': content.oe_teaser|field_value, 'lists': additional_information, + 'lists_variant': 'vertical', 'image': image_url ? { 'src': image_url }, 'badges': badges, 'external_link': external_link diff --git a/templates/content/node--oe-publication--teaser.html.twig b/templates/content/node--oe-publication--teaser.html.twig index f6ae931fe..56769f703 100644 --- a/templates/content/node--oe-publication--teaser.html.twig +++ b/templates/content/node--oe-publication--teaser.html.twig @@ -18,6 +18,7 @@ 'detail': content.oe_teaser|field_value, 'image': image_url ? { 'src': image_url }, 'lists': additional_information, + 'lists_variant': 'vertical', 'badges': badges, 'external_link': external_link }) }} From 7c7b4bf6a5540171a12dd1b553a9648d25cbe08a Mon Sep 17 00:00:00 2001 From: 22Alexandra Date: Mon, 26 Feb 2024 12:43:32 +0200 Subject: [PATCH 2/2] EWPP-4069: Adapt tests. --- .../patterns/field_list/pattern-field-list.html.twig | 2 +- tests/src/Kernel/CallForProposalsRenderTest.php | 5 +++++ tests/src/Kernel/CallForTendersRenderTest.php | 4 ++++ tests/src/Kernel/ConsultationRenderTest.php | 3 +++ tests/src/Kernel/OrganisationRenderTest.php | 3 ++- tests/src/Kernel/PersonRenderTest.php | 6 +++++- tests/src/Kernel/ProjectRenderTest.php | 1 + tests/src/PatternAssertions/FieldListAssert.php | 12 ++++++------ 8 files changed, 27 insertions(+), 9 deletions(-) diff --git a/templates/patterns/field_list/pattern-field-list.html.twig b/templates/patterns/field_list/pattern-field-list.html.twig index 2ff4e27ea..4bf912e6c 100644 --- a/templates/patterns/field_list/pattern-field-list.html.twig +++ b/templates/patterns/field_list/pattern-field-list.html.twig @@ -21,7 +21,7 @@ {% if _items %} {% block content %} {% include '@ecl-twig/description-list' with { - 'variant': variant, + 'variant': variant|default('vertical'), 'items': _items, 'extra_classes': extra_classes, } %} diff --git a/tests/src/Kernel/CallForProposalsRenderTest.php b/tests/src/Kernel/CallForProposalsRenderTest.php index ad3a07c31..92831939b 100644 --- a/tests/src/Kernel/CallForProposalsRenderTest.php +++ b/tests/src/Kernel/CallForProposalsRenderTest.php @@ -130,6 +130,7 @@ public function testTeaser(): void { 'body' => 'Arab Common Market', ], ], + 'variant' => 'vertical', ], ]; $assert->assertPattern($expected_values, $html); @@ -174,6 +175,7 @@ public function testTeaser(): void { 'body' => 'Arab Common Market', ], ], + 'variant' => 'vertical', ]; $assert->assertPattern($expected_values, $html); @@ -215,6 +217,7 @@ public function testTeaser(): void { 'body' => 'Arab Common Market', ], ], + 'variant' => 'vertical', ]; $assert->assertPattern($expected_values, $html); @@ -255,6 +258,7 @@ public function testTeaser(): void { 'body' => 'Arab Common Market', ], ], + 'variant' => 'vertical', ]; $assert->assertPattern($expected_values, $html); @@ -286,6 +290,7 @@ public function testTeaser(): void { 'body' => 'Arab Common Market', ], ], + 'variant' => 'vertical', ]; $assert->assertPattern($expected_values, $html); } diff --git a/tests/src/Kernel/CallForTendersRenderTest.php b/tests/src/Kernel/CallForTendersRenderTest.php index 06c98debc..ffab058e6 100644 --- a/tests/src/Kernel/CallForTendersRenderTest.php +++ b/tests/src/Kernel/CallForTendersRenderTest.php @@ -132,6 +132,7 @@ public function testTeaser(): void { 'body' => 'Audit Board of the European Communities, Arab Common Market', ], ], + 'variant' => 'vertical', ], ]; $assert->assertPattern($expected_values, $html); @@ -168,6 +169,7 @@ public function testTeaser(): void { 'body' => 'Audit Board of the European Communities', ], ], + 'variant' => 'vertical', ]; $assert->assertPattern($expected_values, $html); @@ -203,6 +205,7 @@ public function testTeaser(): void { 'body' => 'Audit Board of the European Communities', ], ], + 'variant' => 'vertical', ]; $assert->assertPattern($expected_values, $html); @@ -242,6 +245,7 @@ public function testTeaser(): void { 'body' => 'Audit Board of the European Communities', ], ], + 'variant' => 'vertical', ]; $assert->assertPattern($expected_values, $html); diff --git a/tests/src/Kernel/ConsultationRenderTest.php b/tests/src/Kernel/ConsultationRenderTest.php index 7c90e85f1..6aa4a175c 100644 --- a/tests/src/Kernel/ConsultationRenderTest.php +++ b/tests/src/Kernel/ConsultationRenderTest.php @@ -115,6 +115,7 @@ public function testTeaser(): void { 'body' => '21 February 2020, 01:00 (AEDT)', ], ], + 'variant' => 'vertical', ], ]; $assert->assertPattern($expected_values, $html); @@ -158,6 +159,7 @@ public function testTeaser(): void { 'body' => '17 February 2020, 12:00 (AEDT)', ], ], + 'variant' => 'vertical', ]; $assert->assertPattern($expected_values, $html); @@ -184,6 +186,7 @@ public function testTeaser(): void { 'body' => '21 February 2020, 12:00 (AEDT)', ], ], + 'variant' => 'vertical', ]; $assert->assertPattern($expected_values, $html); diff --git a/tests/src/Kernel/OrganisationRenderTest.php b/tests/src/Kernel/OrganisationRenderTest.php index 90f490cf2..2ca7d809a 100644 --- a/tests/src/Kernel/OrganisationRenderTest.php +++ b/tests/src/Kernel/OrganisationRenderTest.php @@ -136,6 +136,7 @@ public function testOrganisationTeaser(): void { 'body' => 'Address first_contact, 1001 Brussels, Belgium', ], ], + 'variant' => 'vertical', ], ]; $assert->assertPattern($expected_values, $html); @@ -163,7 +164,7 @@ public function testOrganisationTeaser(): void { $build = $this->nodeViewBuilder->view($node, 'teaser'); $html = $this->renderRoot($build); $crawler = new Crawler($html); - $contacts_render = $crawler->filter('article .ecl-content-block.ecl-content-item__content-block .ecl-description-list.ecl-description-list--horizontal.ecl-content-block__list'); + $contacts_render = $crawler->filter('article .ecl-content-block.ecl-content-item__content-block .ecl-description-list.ecl-description-list--vertical.ecl-content-block__list'); $this->assertCount(2, $contacts_render); $field_assert = new FieldListAssert(); diff --git a/tests/src/Kernel/PersonRenderTest.php b/tests/src/Kernel/PersonRenderTest.php index b9572c681..a4fd54d85 100644 --- a/tests/src/Kernel/PersonRenderTest.php +++ b/tests/src/Kernel/PersonRenderTest.php @@ -136,6 +136,7 @@ public function testTeaser(): void { 'body' => 'Audit Board of the European Communities', ], ], + 'variant' => 'vertical', ]; $assert->assertPattern($expected_values, $this->getRenderedNode($node)); @@ -151,6 +152,7 @@ public function testTeaser(): void { 'body' => 'Audit Board of the European Communities, Arab Common Market', ], ], + 'variant' => 'vertical', ]; $assert->assertPattern($expected_values, $this->getRenderedNode($node)); @@ -193,6 +195,7 @@ public function testTeaser(): void { 'body' => 'Social media direct_contact', ], ], + 'variant' => 'vertical', ]; $assert->assertPattern($expected_values, $this->getRenderedNode($node)); @@ -206,7 +209,7 @@ public function testTeaser(): void { $html = $this->getRenderedNode($node); $crawler = new Crawler($html); - $contacts_render = $crawler->filter('article .ecl-content-block.ecl-content-item__content-block .ecl-description-list.ecl-description-list--horizontal.ecl-content-block__list'); + $contacts_render = $crawler->filter('article .ecl-content-block.ecl-content-item__content-block .ecl-description-list.ecl-description-list--vertical.ecl-content-block__list'); $this->assertCount(3, $contacts_render); $field_assert = new FieldListAssert(); @@ -336,6 +339,7 @@ public function testTeaser(): void { 'body' => 'SingerDescription job_1DancerDescription job_2', ], ], + 'variant' => 'vertical', ], ]; $html = $this->getRenderedNode($node); diff --git a/tests/src/Kernel/ProjectRenderTest.php b/tests/src/Kernel/ProjectRenderTest.php index 3aaed3f36..07afb40f3 100644 --- a/tests/src/Kernel/ProjectRenderTest.php +++ b/tests/src/Kernel/ProjectRenderTest.php @@ -172,6 +172,7 @@ public function testProjectTeaser(): void { 'body' => 'Belgium', ], ], + 'variant' => 'vertical', ], ]; $assert->assertPattern($expected_values, $html); diff --git a/tests/src/PatternAssertions/FieldListAssert.php b/tests/src/PatternAssertions/FieldListAssert.php index c4498fd7c..52ef57b1d 100644 --- a/tests/src/PatternAssertions/FieldListAssert.php +++ b/tests/src/PatternAssertions/FieldListAssert.php @@ -43,13 +43,13 @@ protected function getPatternVariant(string $html): string { $field_list_container = $crawler->filter('dl.ecl-description-list'); $existing_classes = $field_list_container->attr('class'); $existing_classes = explode(' ', $existing_classes); - if (in_array('ecl-description-list--default', $existing_classes)) { - return 'default'; - } if (in_array('ecl-description-list--featured', $existing_classes)) { return 'featured_horizontal'; } - return 'horizontal'; + if (in_array('ecl-description-list--horizontal', $existing_classes)) { + return 'horizontal'; + } + return 'vertical'; } /** @@ -93,10 +93,10 @@ protected function getBaseItemClass(string $variant): string { return '.ecl-description-list--horizontal'; case 'featured_horizontal': - return '.ecl-description-list--horizontal.ecl-description-list--featured'; + return '.ecl-description-list.ecl-description-list--horizontal.ecl-description-list--featured'; default: - return 'ecl-description-list--default'; + return '.ecl-description-list--vertical'; } }