From f214fad3843c643a5c913e4aae58e26a9a2411a7 Mon Sep 17 00:00:00 2001 From: 22Alexandra Date: Tue, 30 Jan 2024 10:55:59 +0200 Subject: [PATCH] EWPP-3876: Re-enable and adapt Organisation tests. --- ...heme-content-organisation-teaser-details.html.twig | 5 ++++- .../pattern-organisation-teaser.html.twig | 4 ++-- .../src/Functional/ContentOrganisationRenderTest.php | 11 +++++------ tests/src/Kernel/OrganisationRenderTest.php | 1 - 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/templates/field/field--node--extra-field-oe-theme-content-organisation-teaser-details.html.twig b/templates/field/field--node--extra-field-oe-theme-content-organisation-teaser-details.html.twig index c2ede84d3..3b300600f 100644 --- a/templates/field/field--node--extra-field-oe-theme-content-organisation-teaser-details.html.twig +++ b/templates/field/field--node--extra-field-oe-theme-content-organisation-teaser-details.html.twig @@ -6,6 +6,9 @@ #} {% for item in items %} {% if item.content|render|striptags|trim is not empty %} - {{ item.content }} + + {{ item.content }} + {% endif %} {% endfor %} diff --git a/templates/patterns/organisation_teaser/pattern-organisation-teaser.html.twig b/templates/patterns/organisation_teaser/pattern-organisation-teaser.html.twig index d5af097a3..9c3bffa6a 100644 --- a/templates/patterns/organisation_teaser/pattern-organisation-teaser.html.twig +++ b/templates/patterns/organisation_teaser/pattern-organisation-teaser.html.twig @@ -14,7 +14,7 @@ */ #} -
+
{% if logo is not empty %}
{% endif %} -
+

{{ name }}{% if acronym is not empty %} ({{ acronym }}){% endif %}

diff --git a/tests/src/Functional/ContentOrganisationRenderTest.php b/tests/src/Functional/ContentOrganisationRenderTest.php index 7a289c89e..957707234 100644 --- a/tests/src/Functional/ContentOrganisationRenderTest.php +++ b/tests/src/Functional/ContentOrganisationRenderTest.php @@ -53,7 +53,6 @@ protected function setUp(): void { * Tests that the Organisation page renders correctly. */ public function testOrganisationRendering(): void { - $this->markTestSkipped('Must be re-enabled before considering migration to ECL 4 as complete.'); $file = \Drupal::service('file.repository')->writeData(file_get_contents(\Drupal::service('extension.list.theme')->getPath('oe_theme') . '/tests/fixtures/example_1.jpeg'), 'public://example_1.jpeg'); $file->setPermanent(); $file->save(); @@ -91,7 +90,7 @@ public function testOrganisationRendering(): void { $this->drupalGet($node->toUrl()); // Assert page header - metadata. - $page_header = $this->assertSession()->elementExists('css', '.ecl-page-header.ecl-page-header--negative'); + $page_header = $this->assertSession()->elementExists('css', '.ecl-page-header'); $assert = new PatternPageHeaderAssert(); $expected_values = [ 'title' => 'My node title', @@ -235,7 +234,7 @@ public function testOrganisationRendering(): void { // Assert Leadership and organisation region is rendered. $this->assertContentHeader($content_items[2], 'Leadership and organisation', 'leadership-and-organisation'); // Assert staff search link values. - $staff_search_link = $content_items[2]->findAll('css', 'a.ecl-link.ecl-link--standalone.ecl-link--icon.ecl-link--icon-after'); + $staff_search_link = $content_items[2]->findAll('css', 'a.ecl-link.ecl-link--standalone.ecl-link--icon'); $this->assertCount(1, $staff_search_link); $this->assertEquals('Search for staff', $staff_search_link[0]->find('css', '.ecl-link__label')->getText()); $staff_search_link[0]->hasLink('https://example.com'); @@ -269,7 +268,7 @@ public function testOrganisationRendering(): void { $this->drupalGet($node->toUrl()); $content_items = $content->findAll('xpath', '/div'); - $person_content = $content_items[2]->findAll('css', 'article.ecl-u-d-flex.ecl-u-pv-m.ecl-u-border-bottom.ecl-u-border-color-grey-15'); + $person_content = $content_items[2]->findAll('css', 'article.ecl-u-d-flex.ecl-u-pv-m.ecl-u-border-bottom.ecl-u-border-color-neutral-40'); $this->assertCount(1, $person_content); $this->assertStringContainsString('node/2', $person_content[0]->find('css', 'a.ecl-link.ecl-link--standalone')->getAttribute('href')); // Assert person content. @@ -288,8 +287,8 @@ public function testOrganisationRendering(): void { $person->set('oe_person_jobs', [$person_job_1, $person_job_2]); $person->save(); $this->getSession()->reload(); - $person_content = $content_items[2]->findAll('css', 'article.ecl-u-d-flex.ecl-u-pv-m.ecl-u-border-bottom.ecl-u-border-color-grey-15'); - $this->assertEquals('Adviser, Chief Adviser', $person_content[0]->find('css', '.ecl-content-item__meta.ecl-u-type-s.ecl-u-type-color-grey-75.ecl-u-mb-xs')->getText()); + $person_content = $content_items[2]->findAll('css', 'article.ecl-u-d-flex.ecl-u-pv-m.ecl-u-border-bottom.ecl-u-border-color-neutral-40'); + $this->assertEquals('Adviser, Chief Adviser', $person_content[0]->find('css', '.ecl-content-item__meta.ecl-u-type-s.ecl-u-type-color-dark-100.ecl-u-mb-xs')->getText()); } } diff --git a/tests/src/Kernel/OrganisationRenderTest.php b/tests/src/Kernel/OrganisationRenderTest.php index 6685a42b8..7c3e8717f 100644 --- a/tests/src/Kernel/OrganisationRenderTest.php +++ b/tests/src/Kernel/OrganisationRenderTest.php @@ -73,7 +73,6 @@ protected function setUp(): void { * Test a organisation being rendered as a teaser. */ public function testOrganisationTeaser(): void { - $this->markTestSkipped('Must be re-enabled before considering migration to ECL 4 as complete.'); $logo_media = $this->createMediaImage('organisation_logo'); $first_contact = $this->createContactEntity('first_contact', 'oe_general');