From 8dc236411843b1fa3aba0af95f1d4c839a6355b8 Mon Sep 17 00:00:00 2001 From: Imanol Eguskiza Date: Tue, 23 Jan 2024 11:25:09 +0100 Subject: [PATCH 1/2] EWPP-3871: Update tests for call for proposals. --- .../ContentCallForProposalsRenderTest.php | 3 +-- tests/src/Functional/ContentRenderTestBase.php | 7 ++++--- tests/src/Kernel/CallForProposalsRenderTest.php | 1 - tests/src/PatternAssertions/FileAssert.php | 14 ++++++++------ 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/tests/src/Functional/ContentCallForProposalsRenderTest.php b/tests/src/Functional/ContentCallForProposalsRenderTest.php index 08d4a5ee1..3052799b9 100644 --- a/tests/src/Functional/ContentCallForProposalsRenderTest.php +++ b/tests/src/Functional/ContentCallForProposalsRenderTest.php @@ -52,7 +52,6 @@ protected function setUp(): void { * Tests full page of Call for proposals. */ public function testProposalRendering(): void { - $this->markTestSkipped('Must be re-enabled before considering migration to ECL 4 as complete.'); // Freeze the time at a specific point. $static_time = new DrupalDateTime('2020-02-17 14:00:00', DateTimeItemInterface::STORAGE_TIMEZONE); $this->freezeTime($static_time); @@ -76,7 +75,7 @@ public function testProposalRendering(): 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(); $header_expected_values = [ 'title' => 'Test Call for proposals node', diff --git a/tests/src/Functional/ContentRenderTestBase.php b/tests/src/Functional/ContentRenderTestBase.php index 3cb0eee95..9ba705f50 100644 --- a/tests/src/Functional/ContentRenderTestBase.php +++ b/tests/src/Functional/ContentRenderTestBase.php @@ -132,13 +132,14 @@ protected function assertMediaDocumentDefaultRender(NodeElement $element, string // Assert documents file. $file_wrapper = $element->find('css', 'div.ecl-file'); $file_row = $file_wrapper->find('css', '.ecl-file .ecl-file__container'); + $file_footer = $file_wrapper->find('css', '.ecl-file .ecl-file__footer'); $file_title = $file_row->find('css', '.ecl-file__title'); $this->assertStringContainsString($name, $file_title->getText()); - $file_info_language = $file_row->find('css', '.ecl-file__info div.ecl-file__language'); + $file_info_language = $file_footer->find('css', ' div.ecl-file__language'); $this->assertStringContainsString($language, $file_info_language->getText()); - $file_info_properties = $file_row->find('css', '.ecl-file__info div.ecl-file__meta'); + $file_info_properties = $file_footer->find('css', 'div.ecl-file__meta'); $this->assertStringContainsString("($meta)", $file_info_properties->getText()); - $file_download_link = $file_row->find('css', '.ecl-file__download'); + $file_download_link = $file_footer->find('css', '.ecl-file__download'); $this->assertStringContainsString($link, $file_download_link->getAttribute('href')); $this->assertStringContainsString($button_label, $file_download_link->getText()); } diff --git a/tests/src/Kernel/CallForProposalsRenderTest.php b/tests/src/Kernel/CallForProposalsRenderTest.php index 9d18c8677..0761e6d1d 100644 --- a/tests/src/Kernel/CallForProposalsRenderTest.php +++ b/tests/src/Kernel/CallForProposalsRenderTest.php @@ -60,7 +60,6 @@ protected function setUp(): void { * Test a call for proposals being rendered as a teaser. */ public function testTeaser(): void { - $this->markTestSkipped('Must be re-enabled before considering migration to ECL 4 as complete.'); // Freeze the time at a specific point. $static_time = new DrupalDateTime('2020-02-17 14:00:00', DateTimeItemInterface::STORAGE_TIMEZONE); diff --git a/tests/src/PatternAssertions/FileAssert.php b/tests/src/PatternAssertions/FileAssert.php index cb5cc5057..ebf0a4432 100644 --- a/tests/src/PatternAssertions/FileAssert.php +++ b/tests/src/PatternAssertions/FileAssert.php @@ -18,7 +18,7 @@ protected function getAssertions($variant): array { return [ 'button_label' => [ [$this, 'assertElementText'], - 'div.ecl-file div.ecl-file__container a.ecl-file__download span.ecl-link__label', + 'div.ecl-file div.ecl-file__footer a.ecl-file__download span.ecl-link__label', ], 'file' => [ [$this, 'assertFile'], @@ -42,13 +42,15 @@ protected function assertBaseElements(string $html, string $variant): void { */ protected function assertFile(array $expected_file, Crawler $crawler): void { // Assert information. - $file_info_element = $crawler->filter('div.ecl-file div.ecl-file__container div.ecl-file__info'); - $this->assertElementText($expected_file['title'], 'div.ecl-file__title', $file_info_element); - $this->assertElementText($expected_file['language'], 'div.ecl-file__language', $file_info_element); - $this->assertElementText($expected_file['meta'], 'div.ecl-file__meta', $file_info_element); + $file_container = $crawler->filter('div.ecl-file div.ecl-file__container'); + $this->assertElementText($expected_file['title'], 'div.ecl-file__title', $file_container); + $file_footer = $crawler->filter('div.ecl-file div.ecl-file__footer'); + + $this->assertElementText($expected_file['language'], 'div.ecl-file__language', $file_footer); + $this->assertElementText($expected_file['meta'], 'div.ecl-file__meta', $file_footer); // Assert download link. - $this->assertElementAttribute($expected_file['url'], 'div.ecl-file div.ecl-file__container a.ecl-file__download', 'href', $crawler); + $this->assertElementAttribute($expected_file['url'], 'div.ecl-file div.ecl-file__footer a.ecl-file__download', 'href', $crawler); // Assert icon. $icon = $crawler->filter('div.ecl-file div.ecl-file__container svg.ecl-file__icon use'); From e570b0b47cb0e7b9a476e82a85468ff67095c0a7 Mon Sep 17 00:00:00 2001 From: Imanol Eguskiza Date: Fri, 26 Jan 2024 10:38:31 +0100 Subject: [PATCH 2/2] EWPP-3871: Use proper border color in call for proposals. --- ...ield-group--group-results--node--oe-call-proposals.html.twig | 2 +- tests/src/Functional/ContentCallForProposalsRenderTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/content/pattern-field-list--field-group--group-results--node--oe-call-proposals.html.twig b/templates/content/pattern-field-list--field-group--group-results--node--oe-call-proposals.html.twig index decb55fdf..1e2926260 100644 --- a/templates/content/pattern-field-list--field-group--group-results--node--oe-call-proposals.html.twig +++ b/templates/content/pattern-field-list--field-group--group-results--node--oe-call-proposals.html.twig @@ -6,7 +6,7 @@ #} {% extends '@oe_theme/patterns/field_list/pattern-field-list.html.twig' %} {% block content %} -
+
{{ parent() }}
{% endblock %} diff --git a/tests/src/Functional/ContentCallForProposalsRenderTest.php b/tests/src/Functional/ContentCallForProposalsRenderTest.php index 3052799b9..1afa12fe5 100644 --- a/tests/src/Functional/ContentCallForProposalsRenderTest.php +++ b/tests/src/Functional/ContentCallForProposalsRenderTest.php @@ -275,7 +275,7 @@ public function testProposalRendering(): void { $node->save(); $this->drupalGet($node->toUrl()); - $results_field_group = $content_items[0]->find('css', 'div.ecl-u-border-top.ecl-u-border-bottom.ecl-u-border-color-grey-15.ecl-u-mt-l.ecl-u-mb-l.ecl-u-pt-l.ecl-u-pb-l'); + $results_field_group = $content_items[0]->find('css', 'div.ecl-u-border-top.ecl-u-border-bottom.ecl-u-border-color-neutral-40.ecl-u-mt-l.ecl-u-mb-l.ecl-u-pt-l.ecl-u-pb-l'); $results_expected_values = [ 'items' => [ [