From f6fa80c95cf7568172a2d0d25513629472cfd464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Mon, 16 Mar 2026 22:38:55 +0800 Subject: [PATCH] fix(admin-dashboard): prevent pay column header wrap --- public/css/admin-components.css | 7 ++++ resources/views/admin/dashboard.blade.php | 2 +- ...tPlatformOrderLinksShouldCarryBackTest.php | 7 +++- ...atformOrdersPayColumnShouldNotWrapTest.php | 39 +++++++++++++++++++ 4 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 tests/Feature/AdminDashboardRecentPlatformOrdersPayColumnShouldNotWrapTest.php diff --git a/public/css/admin-components.css b/public/css/admin-components.css index 79d15f1..bbc9d4d 100644 --- a/public/css/admin-components.css +++ b/public/css/admin-components.css @@ -758,6 +758,13 @@ 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{ margin-top:3px; diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php index e785575..a761f64 100644 --- a/resources/views/admin/dashboard.blade.php +++ b/resources/views/admin/dashboard.blade.php @@ -307,7 +307,7 @@ 查看全部 - +
diff --git a/tests/Feature/AdminDashboardRecentPlatformOrderLinksShouldCarryBackTest.php b/tests/Feature/AdminDashboardRecentPlatformOrderLinksShouldCarryBackTest.php index a000fd6..730cf53 100644 --- a/tests/Feature/AdminDashboardRecentPlatformOrderLinksShouldCarryBackTest.php +++ b/tests/Feature/AdminDashboardRecentPlatformOrderLinksShouldCarryBackTest.php @@ -26,8 +26,13 @@ class AdminDashboardRecentPlatformOrderLinksShouldCarryBackTest extends TestCase $res = $this->get('/admin'); $res->assertOk(); + $html = (string) $res->getContent(); + // 从仪表盘点进订单详情后,应能通过 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 & 泄露) $res->assertDontSee('&back=', false); } } diff --git a/tests/Feature/AdminDashboardRecentPlatformOrdersPayColumnShouldNotWrapTest.php b/tests/Feature/AdminDashboardRecentPlatformOrdersPayColumnShouldNotWrapTest.php new file mode 100644 index 0000000..1130880 --- /dev/null +++ b/tests/Feature/AdminDashboardRecentPlatformOrdersPayColumnShouldNotWrapTest.php @@ -0,0 +1,39 @@ +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); + } +}
订单号