Skip to content

Commit

Permalink
OEL-3315: Fix comparison, use NULL for link.
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronGilMartinez committed Aug 29, 2024
1 parent 64ace6b commit 22e3d8d
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,11 @@ public function testBanner(): void {
$this->assertBannerRendering($crawler, ['title' => NULL]);
$this->assertCount(0, $crawler->filter('.bcl-banner.full-width'));

// Variant - image / Modifier - page_center / Full width - No. / Link - [].
// Variant - image / Modifier - page_center / Full width - No / Link - NULL.
$paragraph->get('field_oe_banner_size')->setValue('medium');
$paragraph->get('field_oe_banner_alignment')->setValue('centered');
$paragraph->get('field_oe_title')->setValue('Banner');
$paragraph->get('field_oe_link')->setValue([]);
$paragraph->get('field_oe_link')->setValue(NULL);
$paragraph->save();
$html = $this->renderParagraph($paragraph);
$crawler = new Crawler($html);
Expand All @@ -384,7 +384,7 @@ public function testBanner(): void {
'url(' . \Drupal::service('file_url_generator')->generateAbsoluteString($en_file->getFileUri()) . ')',
$image_element->attr('style')
);
$this->assertBannerRendering($crawler, ['link_label' => '']);
$this->assertBannerRendering($crawler, ['link_label' => NULL]);
$this->assertCount(0, $crawler->filter('.bcl-banner.full-width'));

// Variant - image / Modifier - page_left / Full width - Yes.
Expand Down Expand Up @@ -689,7 +689,7 @@ protected function assertBannerRendering(Crawler $crawler, array $expected_value
'link_label' => 'Example',
], $expected_values);
// Check optional title.
if (!empty($values['title'])) {
if ($values['title'] !== NULL) {
$this->assertEquals($values['title'], trim($crawler->filter('.bcl-banner__content div')->text()));
}
else {
Expand All @@ -698,7 +698,7 @@ protected function assertBannerRendering(Crawler $crawler, array $expected_value
// Check description text.
$this->assertEquals($values['description'], trim($crawler->filter('.bcl-banner__content p')->text()));
// Check optional button.
if (!empty($values['link_label'])) {
if ($values['link_label'] !== NULL) {
$this->assertCount(1, $crawler->filter('svg.bi.icon--fluid'));
$this->assertStringContainsString($values['link_label'], trim($crawler->filter('a.btn')->text()));
$this->assertStringContainsString('#chevron-right', trim($crawler->filter('a.btn')->html()));
Expand Down

0 comments on commit 22e3d8d

Please sign in to comment.