<?php

namespace Tests\Feature;

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

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

        $res = $this->get('/admin/platform-orders?status=pending');
        $res->assertOk();

        // 默认精简视图：应提供“展开全部列”入口
        $res->assertSee('展开全部列', false);
        $res->assertSee('view=full', false);

        // 展开视图：应提供“精简视图”入口
        $res2 = $this->get('/admin/platform-orders?status=pending&view=full');
        $res2->assertOk();
        $res2->assertSee('精简视图', false);
    }
}
