Files
saasshop/tests/Feature/AdminDashboardKpiCardsShouldBeEqualHeightByCssGuardTest.php

44 lines
1.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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);
}
}