Skip to content

Commit

Permalink
OEL-2082: Handle ID assertion when multiple galleries have been rende…
Browse files Browse the repository at this point in the history
…red.
  • Loading branch information
brummbar committed Nov 7, 2022
1 parent f7c3940 commit d6eb5e4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/src/PatternAssertion/GalleryPatternAssert.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ protected function assertBaseElements(string $html, string $variant): void {
$crawler = new Crawler($html);

$this->assertElementExists('body > .bcl-gallery', $crawler);
$this->assertElementExists('#modalBcl-gallery.modal', $crawler);
// The modal should have "bcl-gallery" appended to the ID. The ID must be
// unique, so when multiple galleries are rendered a double dash and a
// counter are appended.
$crawler->filterXPath('//div[@id="modalBcl-gallery" or starts-with(@id, "modalBcl-gallery--")][@class and contains(concat(" ", normalize-space(@class), " "), " modal ")]');

$items = $crawler->filter('ul.bcl-gallery__grid li')->count();
if ($items > 5) {
Expand Down

0 comments on commit d6eb5e4

Please sign in to comment.