Files
BookStack/tests/View/HeaderBarTest.php
Dan Brown 7782ea00df A11y: Improved alt tag usage for header logo
Set to blank if text is already part of the header, and the app name if
the name is not shown in the header.

For #6171
References:
https://webaim.org/techniques/alttext/
https://www.scottohara.me/blog/2018/05/05/hidden-vs-none.html
2026-09-15 12:07:00 +01:00

33 lines
843 B
PHP

<?php
namespace Tests\View;
use Tests\TestCase;
class HeaderBarTest extends TestCase
{
public function test_header_logo_alt_tag_blank_when_used_with_app_name()
{
$this->setSettings([
'app-name' => 'Dino Docs',
'app-logo' => '',
'app-name-header' => true,
]);
$resp = $this->get('/login');
$this->withHtml($resp)->assertElementExists('header img.logo-image[alt=""]');
}
public function test_header_logo_alt_tag_uses_app_name_when_name_not_shown_in_header()
{
$this->setSettings([
'app-name' => 'Dino Docs',
'app-logo' => '',
'app-name-header' => false,
]);
$resp = $this->get('/login');
$this->withHtml($resp)->assertElementExists('header img.logo-image[alt="Dino Docs"]');
}
}