fix(admin-ui): prevent orders dashboard dark background regression

This commit is contained in:
萝卜
2026-03-16 11:56:37 +08:00
parent b52a0f45f6
commit a5edeb04ef
4 changed files with 53 additions and 3 deletions

View File

@@ -0,0 +1,38 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminOrdersIndexSectionDarkShouldUseSurfaceTintTest 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_orders_index_should_not_use_hardcoded_dark_section_background(): void
{
$this->loginAsPlatformAdmin();
$res = $this->get('/admin/orders');
$res->assertOk();
// 页面仍然可以使用 section-dark 作为“强调区块”类名,但样式不应回到深色背景
$res->assertSee('section-dark', false);
$css = (string) file_get_contents(public_path('css/admin-base.css'));
// 旧版硬编码深色背景background:#0f172a
$this->assertStringNotContainsString('background:#0f172a', $css);
$this->assertStringContainsString('--adm-surface-tint', $css);
}
}