admin ui: make filter-error use theme error tokens

This commit is contained in:
萝卜
2026-03-16 00:40:43 +08:00
parent 8d629e9dbb
commit 4754f8379d
2 changed files with 41 additions and 4 deletions

View File

@@ -259,10 +259,10 @@ input.w-90{width:90px;}
.filter-error{ .filter-error{
margin-bottom:12px; margin-bottom:12px;
padding:12px; padding:12px;
border:1px solid #fecaca; border:1px solid rgba(239, 68, 68, .25);
background:#fef2f2; background:var(--adm-error-bg, #fef2f2);
color:#991b1b; color:var(--adm-error, #ef4444);
border-radius:8px; border-radius:var(--adm-radius-sm, 10px);
} }
.actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;} .actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;}

View File

@@ -0,0 +1,37 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminBaseCssFilterErrorShouldUseThemeErrorTokensTest extends TestCase
{
use RefreshDatabase;
protected function loginAsPlatformAdmin(): void
{
$this->seed();
$this->post('/admin/login', [
'email' => 'platform.admin@demo.local',
'password' => 'Platform@123456',
])->assertRedirect('/admin');
}
public function test_admin_base_css_filter_error_should_use_theme_error_tokens(): void
{
$this->loginAsPlatformAdmin();
$css = file_get_contents(public_path('css/admin-base.css'));
$this->assertIsString($css);
// filter-error 属于错误提示组件,应引用主题错误令牌(便于全站统一风格)
$this->assertStringContainsString('.filter-error{', $css);
$this->assertStringContainsString('background:var(--adm-error-bg', $css);
$this->assertStringContainsString('color:var(--adm-error', $css);
// 不应再硬编码旧的暗红色文本(#991b1b
$this->assertStringNotContainsString('#991b1b', $css);
}
}