Skip to content

Commit

Permalink
Merge pull request #192 from localgovdrupal/1.x
Browse files Browse the repository at this point in the history
Release 1.0.6
  • Loading branch information
rupertj authored Aug 22, 2024
2 parents c796c4b + db58907 commit 46313b3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Plugin/Block/PublicationNavigationBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function build() {
// page publication) don't show the menu block, as there isn't anything
// else to navigate to.
$top = reset($tree);
if (!isset($top['below'])) {
if (!isset($top['below']) || $top['below'] === []) {
return [];
}

Expand Down
10 changes: 8 additions & 2 deletions tests/src/Functional/PublicationPageNavigationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PublicationPageNavigationTest extends BrowserTestBase {
];

/**
* Test the 'next page' link on a publication.
* Test that links and nav are present on a multi-page publication.
*/
public function testPreviousNextLinks() {
$adminUser = $this->drupalCreateUser([], NULL, TRUE);
Expand Down Expand Up @@ -93,6 +93,9 @@ public function testPreviousNextLinks() {
$this->drupalGet('/node/' . $node_child_one->id());
$this->assertSession()->responseContains('<a href="/publication-parent-page" rel="prev" title="Go to previous page">');
$this->assertSession()->responseContains('<a href="/publication-parent-page/publication-child-page-two" rel="next" title="Go to next page">');

// This is the default title of the publication navigation block.
$this->assertSession()->pageTextContains('Publication navigation');
}

/**
Expand All @@ -113,7 +116,10 @@ public function testBookNavigationIsNotDisplayed() {
'status' => NodeInterface::PUBLISHED,
]);
$this->drupalGet('/node/' . $node_parent->id());
$this->assertSession()->elementNotExists('css', '#block-booknavigation');

// This is the default title of the publication navigation block.
// It shouldn't show on a single page publication.
$this->assertSession()->pageTextNotContains('Publication navigation');
}

}

0 comments on commit 46313b3

Please sign in to comment.