Skip to content

Commit

Permalink
Merge pull request #941 from mollie/fix/PIWOO-540-gateway-icon-a11y-i…
Browse files Browse the repository at this point in the history
…mprovement

Fix/piwoo 540 gateway icon a11y improvement
  • Loading branch information
mmaymo authored Sep 25, 2024
2 parents 33f1370 + 9a373a1 commit 914b5c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/PaymentMethods/PaymentMethodsIconUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function generateIconHtml($svgUrl)
{

return '<img src="' . esc_url($svgUrl)
. '" class="mollie-gateway-icon" />';
. '" class="mollie-gateway-icon" alt=""/>';
}

public function getCreditcardIcon()
Expand All @@ -106,12 +106,12 @@ public function getCreditcardIcon()
if ($this->canShowCustomLogo($gatewaySettings)) {
$url = $gatewaySettings["iconFileUrl"];
return '<img src="' . esc_url($url)
. '" class="mollie-gateway-icon" />';
. '" class="mollie-gateway-icon" alt=""/>';
}
$svgUrl = $this->pluginUrl . sprintf('public/images/%ss.svg', PaymentMethod::CREDITCARD);
return
'<img src="' . esc_url($svgUrl)
. '" class="mollie-gateway-icon" />';
. '" class="mollie-gateway-icon" alt=""/>';
}

protected function canShowCustomLogo($gatewaySettings): bool
Expand Down
6 changes: 3 additions & 3 deletions tests/php/Functional/PaymentMethod/PaymentMethodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function showDefaultIcon(){
$this->helperMocks->paymentMethodMergedProperties($paymentMethodName, false, true)
);
expect('esc_url')->with($urlBuild)->andReturn($urlBuild);
$expectedUrl = '<img src="' . $urlBuild . '" class="mollie-gateway-icon" />';
$expectedUrl = '<img src="' . $urlBuild . '" class="mollie-gateway-icon" alt=""/>';
$iconUrl = $testee->getIconUrl();
self::assertEquals($expectedUrl, $iconUrl);
}
Expand Down Expand Up @@ -79,7 +79,7 @@ public function fallbackToDefaultIcon(){
);
expect('esc_url')->withAnyArgs()->andReturn($urlBuild);

$expectedUrl = '<img src="' . $urlBuild . '" class="mollie-gateway-icon" />';
$expectedUrl = '<img src="' . $urlBuild . '" class="mollie-gateway-icon" alt=""/>';
$iconUrl = $testee->getIconUrl();
self::assertEquals($expectedUrl, $iconUrl);
}
Expand Down Expand Up @@ -109,7 +109,7 @@ public function showCustomIcon(){
expect('file_exists')->with($testSettings['iconFilePath'])->andReturn(true);
expect('esc_url')->withAnyArgs()->andReturn($urlBuild);

$expectedUrl = '<img src="' . $urlBuild . '" class="mollie-gateway-icon" />';
$expectedUrl = '<img src="' . $urlBuild . '" class="mollie-gateway-icon" alt=""/>';
$iconUrl = $testee->getIconUrl();
self::assertEquals($expectedUrl, $iconUrl);
}
Expand Down

0 comments on commit 914b5c6

Please sign in to comment.