44 lines
1.4 KiB
PHP
44 lines
1.4 KiB
PHP
<?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);
|
||
}
|
||
}
|