fix(admin-dashboard): make KPI cards equal height
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminDashboardKpiCardsShouldBeEqualHeightByCssGuardTest 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_kpi_grid_should_enable_equal_height_cards_via_css(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$res = $this->get('/admin');
|
||||
$res->assertOk();
|
||||
|
||||
// 结构护栏:KPI 区必须存在
|
||||
$res->assertSee('data-role="kpi-grid"', false);
|
||||
|
||||
$css = (string) file_get_contents(public_path('css/admin-components.css'));
|
||||
|
||||
// 护栏:kpi-grid 应显式 stretch,且卡片应为 flex column(保证等高和脚注沉底)
|
||||
$this->assertStringContainsString('.kpi-grid{', $css);
|
||||
$this->assertStringContainsString('align-items:stretch', $css);
|
||||
$this->assertStringContainsString('.kpi-grid .card', $css);
|
||||
$this->assertStringContainsString('display:flex', $css);
|
||||
$this->assertStringContainsString('flex-direction:column', $css);
|
||||
$this->assertStringContainsString('.kpi-grid .stat-card-footnote', $css);
|
||||
$this->assertStringContainsString('margin-top:auto', $css);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user