diff --git a/tests/src/PatternAssertions/ListItemAssert.php b/tests/src/PatternAssertions/ListItemAssert.php index 726343fc8..731ee760e 100644 --- a/tests/src/PatternAssertions/ListItemAssert.php +++ b/tests/src/PatternAssertions/ListItemAssert.php @@ -229,6 +229,10 @@ protected function assertHighlightImage($expected_image, string $variant, Crawle protected function assertDescription($expected, string $variant, Crawler $crawler): void { $base_selector = $this->getBaseItemClass($variant); $description_selector = 'div' . $base_selector . '__description'; + if (is_null($expected)) { + $this->assertElementNotExists($description_selector, $crawler); + return; + } $this->assertElementExists($description_selector, $crawler); $description_element = $crawler->filter($description_selector); if ($expected instanceof PatternAssertStateInterface) {