Skip to content

Commit

Permalink
Merge pull request #1206 from openeuropa/EPIC-EWPP-2575
Browse files Browse the repository at this point in the history
EWPP-2575: Calendar item epic.
  • Loading branch information
22Alexandra authored Nov 3, 2022
2 parents 4dd21e4 + df92ab0 commit 0f9be78
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@
"Explicit minimum version requirement of drupal/ctools module due to D9.3 compatability.",
"Explicit minimum version requirement of behat library due to PHP compatibility.",
"Explicit minimum version requirement of fabpot/goutte due to Drupal 9.3 compatability.",
"Explicit minimum version requirement for symfony/dom-crawler due to its lower versions using the deprecated function libxml_disable_entity_loader() in PHP8."
"Explicit minimum version requirement for symfony/dom-crawler due to its lower versions using the deprecated function libxml_disable_entity_loader() in PHP8.",
"Locking json_field until https://www.drupal.org/project/json_field/issues/3314641 is fixed and released."
]
},
"config": {
Expand Down
3 changes: 3 additions & 0 deletions modules/oe_theme_helper/oe_theme_helper.module
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,9 @@ function oe_theme_helper_entity_bundle_info_alter(&$bundles) {
* Implements hook_form_FORM_ID_alter() for the entity view display form.
*/
function oe_theme_helper_form_entity_view_display_edit_form_alter(&$form, FormStateInterface $form_state) {
if (!isset($form['#fieldgroups'])) {
return;
}
foreach ($form['#fieldgroups'] as $name) {
if ($form['fields'][$name]['human_name']['#markup'] === "") {
$form['fields'][$name]['human_name']['#markup'] = t('- No label -');
Expand Down
2 changes: 1 addition & 1 deletion tests/src/PatternAssertions/FeaturedItemAssert.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protected function assertBadges(?array $expected_badges, Crawler $crawler): void
if (!isset($badge['label']) || !isset($badge['variant'])) {
continue;
}
$selector = $base_selector . ' span.ecl-label.ecl-label--' . $badge['variant'] . '.ecl-u-mr-xs';
$selector = $base_selector . ' span.ecl-label.ecl-label--' . $badge['variant'];
self::assertStringContainsString($badge['label'], $crawler->filter($selector)->text());
}
}
Expand Down
26 changes: 26 additions & 0 deletions tests/src/PatternAssertions/ListItemAssert.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ protected function getAssertions($variant): array {
'meta' => [
[$this, 'assertPrimaryMeta'],
],
'secondary_meta' => [
[$this, 'assertSecondaryMeta'],
],
'date' => [
[$this, 'assertDate'],
$variant,
Expand Down Expand Up @@ -317,4 +320,27 @@ protected function assertPrimaryMeta($expected_items, Crawler $crawler): void {
}
}

/**
* Asserts the secondary meta items of the list item.
*
* @param array|null $expected_items
* The expected secondary meta items.
* @param \Symfony\Component\DomCrawler\Crawler $crawler
* The DomCrawler where to check the element.
*/
protected function assertSecondaryMeta($expected_items, Crawler $crawler): void {
if (is_null($expected_items)) {
$this->assertElementNotExists('.ecl-content-block__secondary-meta-container', $crawler);
return;
}
$actual_items = $crawler->filter('div.ecl-content-item__content-block ul.ecl-content-block__secondary-meta-container li.ecl-content-block__secondary-meta-item');
self::assertCount(count($expected_items), $actual_items, 'The expected secondary meta items do not match the found items.');
foreach ($expected_items as $index => $expected_item) {
$info_element = $actual_items->eq($index);
$icon_element = $info_element->filter('svg.ecl-icon.ecl-icon--s.ecl-content-block__secondary-meta-icon use');
$this::assertStringContainsString('#' . $expected_item['icon'], $icon_element->attr('xlink:href'));
$this->assertElementText($expected_item['text'], 'span.ecl-content-block__secondary-meta-label', $info_element);
}
}

}

0 comments on commit 0f9be78

Please sign in to comment.