fix(admin-dashboard): prevent pay column header wrap

This commit is contained in:
萝卜
2026-03-16 22:38:55 +08:00
parent 502c397ec2
commit f6fa80c95c
4 changed files with 53 additions and 2 deletions

View File

@@ -758,6 +758,13 @@
margin-right:4px; margin-right:4px;
} }
/* 仪表盘最近订单避免「支付」表头在窄宽下被拆成竖排CJK 可在任意字间断行) */
[data-page="admin.dashboard"] [data-role="recent-platform-orders-table"] th:nth-child(4),
[data-page="admin.dashboard"] [data-role="recent-platform-orders-table"] td:nth-child(4){
white-space:nowrap;
min-width:56px;
}
/* 仪表盘最近订单:扫描信息行(用于快速判断治理状态,不替代下方治理提示入口) */ /* 仪表盘最近订单:扫描信息行(用于快速判断治理状态,不替代下方治理提示入口) */
[data-page="admin.dashboard"] .adm-order-scanline{ [data-page="admin.dashboard"] .adm-order-scanline{
margin-top:3px; margin-top:3px;

View File

@@ -307,7 +307,7 @@
<a class="muted" href="{!! $platformOrdersIndexUrl !!}">查看全部</a> <a class="muted" href="{!! $platformOrdersIndexUrl !!}">查看全部</a>
</div> </div>
<table> <table data-role="recent-platform-orders-table">
<thead> <thead>
<tr> <tr>
<th>订单号</th> <th>订单号</th>

View File

@@ -26,8 +26,13 @@ class AdminDashboardRecentPlatformOrderLinksShouldCarryBackTest extends TestCase
$res = $this->get('/admin'); $res = $this->get('/admin');
$res->assertOk(); $res->assertOk();
$html = (string) $res->getContent();
// 从仪表盘点进订单详情后,应能通过 back 回到 /admin // 从仪表盘点进订单详情后,应能通过 back 回到 /admin
$res->assertSee('href="/admin/platform-orders/1?back=%2Fadmin"', false); // 备注:订单 ID 不应被测试写死seed 数据可能调整)。这里只校验“任意一条详情链接”携带 back=%2Fadmin。
$this->assertMatchesRegularExpression('/href="\\/admin\\/platform-orders\\/\\d+\\?back=%2Fadmin"/', $html);
// back 必须是一次性的(避免 nested back / HTML &amp; 泄露)
$res->assertDontSee('&amp;back=', false); $res->assertDontSee('&amp;back=', false);
} }
} }

View File

@@ -0,0 +1,39 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminDashboardRecentPlatformOrdersPayColumnShouldNotWrapTest 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_recent_platform_orders_pay_column_should_have_nowrap_guard(): void
{
$this->loginAsPlatformAdmin();
$res = $this->get('/admin');
$res->assertOk();
// 结构护栏:最近平台订单 table 必须可被稳定选择
$res->assertSee('data-role="recent-platform-orders-table"', false);
$css = (string) file_get_contents(public_path('css/admin-components.css'));
// CSS 护栏:第 4 列(支付)必须明确 nowrap + min-width
$this->assertStringContainsString('[data-role="recent-platform-orders-table"] th:nth-child(4)', $css);
$this->assertStringContainsString('white-space:nowrap', $css);
$this->assertStringContainsString('min-width:56px', $css);
}
}