style(admin): scope row-warn styles for dashboard and keep platform orders guards
This commit is contained in:
@@ -672,7 +672,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 平台订单列表:行内治理提示(精简视图主要入口) */
|
/* 平台订单列表:行内治理提示(精简视图主要入口) */
|
||||||
.platform-orders-table .row-warn{
|
.platform-orders-table .row-warn,
|
||||||
|
[data-page="admin.dashboard"] .row-warn{
|
||||||
margin-top:4px;
|
margin-top:4px;
|
||||||
padding:4px 6px;
|
padding:4px 6px;
|
||||||
border-left:3px solid var(--adm-error, #ef4444);
|
border-left:3px solid var(--adm-error, #ef4444);
|
||||||
@@ -680,16 +681,19 @@
|
|||||||
border-radius:4px;
|
border-radius:4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.platform-orders-table .row-warn a.link{
|
.platform-orders-table .row-warn a.link,
|
||||||
|
[data-page="admin.dashboard"] .row-warn a.link{
|
||||||
color:var(--adm-error, #ef4444);
|
color:var(--adm-error, #ef4444);
|
||||||
text-decoration:underline;
|
text-decoration:underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.platform-orders-table .row-warn a.link:hover{
|
.platform-orders-table .row-warn a.link:hover,
|
||||||
|
[data-page="admin.dashboard"] .row-warn a.link:hover{
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.platform-orders-table .row-warn-prefix{
|
.platform-orders-table .row-warn-prefix,
|
||||||
|
[data-page="admin.dashboard"] .row-warn-prefix{
|
||||||
font-weight:600;
|
font-weight:600;
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
padding:1px 6px;
|
padding:1px 6px;
|
||||||
|
|||||||
@@ -32,9 +32,10 @@ class AdminComponentsCssGovernanceBlocksShouldUseThemeTokensTest extends TestCas
|
|||||||
$this->assertStringContainsString('background:var(--adm-error-bg', $css);
|
$this->assertStringContainsString('background:var(--adm-error-bg', $css);
|
||||||
|
|
||||||
// 列表行内治理提示(row-warn)也必须用 token。
|
// 列表行内治理提示(row-warn)也必须用 token。
|
||||||
$this->assertStringContainsString('.platform-orders-table .row-warn{', $css);
|
// row-warn/row-warn-prefix 允许复用到仪表盘(按页面 scope),但平台订单列表的 scope 仍必须存在。
|
||||||
|
$this->assertStringContainsString('.platform-orders-table .row-warn', $css);
|
||||||
$this->assertStringContainsString('border-left:3px solid var(--adm-error', $css);
|
$this->assertStringContainsString('border-left:3px solid var(--adm-error', $css);
|
||||||
$this->assertStringContainsString('.platform-orders-table .row-warn-prefix{', $css);
|
$this->assertStringContainsString('.platform-orders-table .row-warn-prefix', $css);
|
||||||
$this->assertStringContainsString('background:var(--adm-error-tint', $css);
|
$this->assertStringContainsString('background:var(--adm-error-tint', $css);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class AdminDashboardRowWarnStyleShouldBeScopedTest extends TestCase
|
||||||
|
{
|
||||||
|
public function test_admin_dashboard_row_warn_style_should_be_scoped(): void
|
||||||
|
{
|
||||||
|
$css = (string) file_get_contents(public_path('css/admin-components.css'));
|
||||||
|
|
||||||
|
// 仪表盘最近订单也使用 row-warn/row-warn-prefix,但必须“按页面范围”提供样式,避免依赖平台订单列表页的 table scope。
|
||||||
|
$this->assertStringContainsString('[data-page="admin.dashboard"] .row-warn{', $css);
|
||||||
|
$this->assertStringContainsString('[data-page="admin.dashboard"] .row-warn-prefix{', $css);
|
||||||
|
|
||||||
|
// 保持治理:禁止出现全局 .row-warn{...} 或 .row-warn-prefix{...},避免污染其它页面。
|
||||||
|
$this->assertStringNotContainsString("\n.row-warn{", $css);
|
||||||
|
$this->assertStringNotContainsString("\n.row-warn-prefix{", $css);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,7 +26,8 @@ class AdminPlatformOrderIndexRowWarnPrefixStyleScopedTest extends TestCase
|
|||||||
$css = file_get_contents(public_path('css/admin-components.css'));
|
$css = file_get_contents(public_path('css/admin-components.css'));
|
||||||
$this->assertIsString($css);
|
$this->assertIsString($css);
|
||||||
|
|
||||||
$this->assertStringContainsString('.platform-orders-table .row-warn-prefix{', $css);
|
// 允许同一套样式同时覆盖仪表盘最近订单(通过 [data-page="admin.dashboard"] 范围),但平台订单列表的 scope 仍必须存在。
|
||||||
|
$this->assertStringContainsString('.platform-orders-table .row-warn-prefix', $css);
|
||||||
|
|
||||||
// 避免全局污染
|
// 避免全局污染
|
||||||
$this->assertStringNotContainsString("\n.row-warn-prefix{", $css);
|
$this->assertStringNotContainsString("\n.row-warn-prefix{", $css);
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ class AdminPlatformOrderIndexRowWarnStyleScopedTest extends TestCase
|
|||||||
$css = file_get_contents(public_path('css/admin-components.css'));
|
$css = file_get_contents(public_path('css/admin-components.css'));
|
||||||
|
|
||||||
$this->assertIsString($css);
|
$this->assertIsString($css);
|
||||||
$this->assertStringContainsString('.platform-orders-table .row-warn{', $css);
|
// 允许同一套样式同时覆盖仪表盘最近订单(通过 [data-page="admin.dashboard"] 范围),但平台订单列表的 scope 仍必须存在。
|
||||||
|
$this->assertStringContainsString('.platform-orders-table .row-warn', $css);
|
||||||
|
|
||||||
// 仅避免“全局 .row-warn{...}”这种写法(会污染其它页面)。
|
// 仅避免“全局 .row-warn{...}”这种写法(会污染其它页面)。
|
||||||
$this->assertStringNotContainsString("\n.row-warn{", $css);
|
$this->assertStringNotContainsString("\n.row-warn{", $css);
|
||||||
|
|||||||
Reference in New Issue
Block a user