Skip to content

Commit

Permalink
Merge pull request #152 from openeuropa/OEL-1540
Browse files Browse the repository at this point in the history
OEL-1540: Fix Scrollspy js file requirement when there is no items to display.
  • Loading branch information
drishu authored Jun 9, 2022
2 parents 2ad85ab + ff18179 commit 3ff75d2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@
"patches": {
"drupal/entity_reference_revisions": {
"https://www.drupal.org/project/entity_reference_revisions/issues/2937835": "https://www.drupal.org/files/issues/2021-03-26/entity_reference_revisions-field_formatter_label-2937835-36.patch"
},
"openeuropa/oe_bootstrap_theme": {
"latest": "https://github.com/openeuropa/oe_bootstrap_theme/compare/0.1.202206071025..1.x.diff"
}
},
"drupal-scaffold": {
Expand Down
16 changes: 10 additions & 6 deletions templates/content/node--oe-sc-event--full.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@
{% endset %}

<article{{attributes}}>
{{ pattern('inpage_navigation', {
title: 'Page content',
links: inpage_navigation_links,
content: inpage_navigation_fields,
full_layout: true,
}) }}
{% if inpage_navigation_links is empty %}
{{ inpage_navigation_fields }}
{% else %}
{{ pattern('inpage_navigation', {
title: 'Page content',
links: inpage_navigation_links,
content: inpage_navigation_fields,
full_layout: true,
}) }}
{% endif %}
</article>
9 changes: 9 additions & 0 deletions tests/src/Functional/ContentEventRenderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ public function testEventPage(): void {
'Event body',
$crawler->filter('#oe-content-body p')->text()
);

// Assert inpage_navigation not loaded if there is no body and documents.
$node->set('oe_documents', NULL);
$node->set('body', NULL);
$node->save();

$this->drupalGet('node/' . $node->id());

$this->assertSession()->elementNotExists('css', 'nav.bcl-inpage-navigation');
}

/**
Expand Down

0 comments on commit 3ff75d2

Please sign in to comment.