<?php

namespace Tests\Feature;

use Tests\TestCase;

class AdminJsPlanOrderShareTop5ShouldReuseTablePlanLinksSelectorTest extends TestCase
{
    public function test_admin_js_plan_order_share_top5_should_reuse_table_plan_links_selector(): void
    {
        $js = (string) file_get_contents(public_path('js/admin.js'));

        // 护栏：占比条形图应从表格复用 plan_id 链接口径（避免 JS 里硬编码 created_from/to 规则）
        $this->assertStringContainsString('[data-role="plan-order-share-top5"] a.link[href*="plan_id="]', $js);

        // 且支持 a/div 二选一（可点击则 <a>）
        $this->assertStringContainsString("document.createElement(href ? 'a' : 'div')", $js);
        $this->assertStringContainsString('adm-mini-share-row-link', $js);
    }
}
