<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class AdminComponentsCssPlatformOrdersFormattingTest 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_admin_components_css_contains_platform_orders_blocks_with_braced_formatting(): void
    {
        $this->loginAsPlatformAdmin();

        $css = file_get_contents(public_path('css/admin-components.css'));
        $this->assertIsString($css);

        // 轻量格式存在性断言：平台订单列表相关 selector 应使用多行块格式，便于长期维护
        $this->assertStringContainsString(".platform-orders-table .col-optional{\n", $css);
        $this->assertStringContainsString(".platform-orders-table.is-full .col-optional{\n", $css);
        $this->assertStringContainsString(".platform-orders-table .row-warn{\n", $css);
        $this->assertStringContainsString(".platform-orders-table .row-warn-prefix{\n", $css);
    }
}
