feat: add 15 new WCAG rules, dynamic ARIA checks and bump version to v3.1.4

This commit is contained in:
Enes Yakıştır
2026-07-30 20:34:41 +03:00
parent 164828f9f7
commit 58b1618d96
31 changed files with 1138 additions and 1 deletions
+38
View File
@@ -0,0 +1,38 @@
<?php
namespace YakNet\AccessibilityConsole\Tests\Rules;
use PHPUnit\Framework\TestCase;
use YakNet\AccessibilityConsole\Core\Scanner;
use YakNet\AccessibilityConsole\Rules\FocusableWithoutRole;
class FocusableWithoutRoleTest extends TestCase
{
public function testFlagsFocusableDivWithoutRole(): void
{
$scanner = new Scanner();
$scanner->addRule(new FocusableWithoutRole());
$violations = $scanner->scan('<div tabindex="0">Click me</div>');
$this->assertCount(1, $violations);
$this->assertSame('WCAG_4_1_2_FOCUSABLE_ROLE', $violations[0]->ruleId);
}
public function testPassesFocusableDivWithRole(): void
{
$scanner = new Scanner();
$scanner->addRule(new FocusableWithoutRole());
$violations = $scanner->scan('<div tabindex="0" role="button">Click me</div>');
$this->assertCount(0, $violations);
}
public function testPassesNegativeTabindexDiv(): void
{
$scanner = new Scanner();
$scanner->addRule(new FocusableWithoutRole());
$violations = $scanner->scan('<div tabindex="-1">Programmatic focus only</div>');
$this->assertCount(0, $violations);
}
}