admin-components: style row-warn hint as subtle alert and assert scoping

This commit is contained in:
萝卜
2026-03-14 13:17:11 +00:00
parent 714cbe7ba4
commit 2b692497e7
2 changed files with 36 additions and 1 deletions

View File

@@ -90,7 +90,7 @@
.platform-orders-table.is-compact td{padding-top:8px;padding-bottom:8px;}
.platform-orders-table.is-compact .muted-xs{font-size:12px;}
.platform-orders-table .row-meta{margin-top:2px;}
.platform-orders-table .row-warn{margin-top:4px;}
.platform-orders-table .row-warn{margin-top:4px;padding:4px 6px;border-left:3px solid #d9534f;background:#fff6f6;border-radius:4px;}
/* 平台订单列表:精简视图也要可达的治理提示(对账/退款不一致) */
.platform-orders-table .governance-hints{margin-bottom:6px;}

View File

@@ -0,0 +1,35 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlatformOrderIndexRowWarnStyleScopedTest 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_row_warn_style_is_scoped_under_platform_orders_table_only(): void
{
$this->loginAsPlatformAdmin();
// 通过直接读取 CSS 内容做“范围约束”断言:必须以 .platform-orders-table 开头,避免全局污染
$css = file_get_contents(public_path('css/admin-components.css'));
$this->assertIsString($css);
$this->assertStringContainsString('.platform-orders-table .row-warn{', $css);
// 仅避免“全局 .row-warn{...}”这种写法(会污染其它页面)。
$this->assertStringNotContainsString("\n.row-warn{", $css);
}
}