Skip to content

Commit

Permalink
Merge pull request #139 from localgovdrupal/2.x
Browse files Browse the repository at this point in the history
2.1.5 release
  • Loading branch information
finnlewis authored Dec 7, 2023
2 parents 71c0657 + 2a42c84 commit d27eb3c
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions tests/src/Functional/PageHeaderBlockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,31 @@ public function testGuidePageHeaderBlock() {
]);

$this->drupalGet($overview->toUrl()->toString());
$this->assertSession()->responseContains('<h1 class="header">' . $overview_title . '</h1>');
$query = $this->xpath('.//h1[contains(concat(" ",normalize-space(@class)," ")," header ")]');
$found_title = $query[0]->getText();
$this->assertEquals($found_title, $overview_title);

$this->drupalGet($page->toUrl()->toString());
$this->assertSession()->responseContains('<h1 class="header">' . $overview_title . '</h1>');
$this->assertSession()->responseNotContains('<h1 class="header">' . $page_title . '</h1>');
$query = $this->xpath('.//h1[contains(concat(" ",normalize-space(@class)," ")," header ")]');
$found_title = $query[0]->getText();
$this->assertEquals($found_title, $overview_title);
$this->assertNotEquals($found_title, $page_title);

$this->drupalGet($orphan->toUrl()->toString());
$this->assertSession()->responseNotContains('<h1 class="header">' . $overview_title . '</h1>');
$this->assertSession()->responseContains('<h1 class="header">' . $orphan_title . '</h1>');
$query = $this->xpath('.//h1[contains(concat(" ",normalize-space(@class)," ")," header ")]');
$found_title = $query[0]->getText();
$this->assertNotEquals($found_title, $overview_title);
$this->assertEquals($found_title, $orphan_title);

$new_overview_title = 'Guide overview - ' . $this->randomMachineName(8);
$overview->set('title', $new_overview_title);
$overview->save();

$this->drupalGet($page->toUrl()->toString());
$this->assertSession()->responseNotContains($overview_title);
$this->assertSession()->responseContains('<h1 class="header">' . $new_overview_title . '</h1>');
$query = $this->xpath('.//h1[contains(concat(" ",normalize-space(@class)," ")," header ")]');
$found_title = $query[0]->getText();
$this->assertEquals($found_title, $new_overview_title);
}

}

0 comments on commit d27eb3c

Please sign in to comment.