<?php

namespace MintyPHP\Tests\Architecture;

use PHPUnit\Framework\TestCase;

final class AuthLoginPasswordToggleContractTest extends TestCase
{
    use ProjectFileAssertionSupport;

    public function testPasswordToggleUsesLocalizedLabelsAndKeyboardFocusableControl(): void
    {
        $layoutContent = $this->readProjectFile('templates/login.phtml');
        $scriptContent = $this->readProjectFile('web/js/components/app-password-toggle.js');

        $this->assertStringContainsString('data-password-toggle-show-label', $layoutContent);
        $this->assertStringContainsString('data-password-toggle-hide-label', $layoutContent);

        $this->assertStringContainsString('passwordToggleShowLabel', $scriptContent);
        $this->assertStringContainsString('passwordToggleHideLabel', $scriptContent);
        $this->assertStringNotContainsString('toggle.tabIndex = -1;', $scriptContent);
        $this->assertStringNotContainsString("'Show password'", $scriptContent);
        $this->assertStringNotContainsString("'Hide password'", $scriptContent);
    }
}
