Files
postfixadmin/tests/VirtualSearchTemplateTest.php
Rodrigo Cortés Cano e6a0b3a179 Label the virtual address search field (#1148)
The virtual-address overview currently shows a blank search box with
only a hard-coded English tooltip. Add a visible translated placeholder
and an accessible name: "Search mailboxes and aliases..." (Spanish:
"Buscar buzones y alias...").

thanks @TrapoSAMA
2026-09-06 14:26:30 +01:00

25 lines
1.1 KiB
PHP

<?php
class VirtualSearchTemplateTest extends \PHPUnit\Framework\TestCase
{
public function testSearchHintIsTranslatedAndKeepsTheExistingRequestContract(): void
{
global $CONF;
$smarty = new \Smarty\Smarty();
$smarty->setCompileDir(sys_get_temp_dir());
$smarty->setTemplateDir(__DIR__ . '/../templates');
foreach (['en', 'es'] as $language) {
$PALANG = [];
require __DIR__ . '/../languages/' . $language . '.lang';
$smarty->assign('PALANG', $PALANG);
$html = $smarty->fetch('virtual-search.tpl');
self::assertStringContainsString('method="post" action="list-virtual.php"', $html);
self::assertStringContainsString('name="search[_]"', $html);
self::assertStringContainsString('placeholder="' . $PALANG['search_mailboxes_aliases'] . '"', $html);
self::assertStringContainsString('aria-label="' . $PALANG['search_mailboxes_aliases'] . '"', $html);
}
self::assertStringContainsString("{include file='virtual-search.tpl'}", file_get_contents(__DIR__ . '/../templates/list-virtual.tpl'));
}
}